diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json
index e9a1ab81399b..adf0f41e5dc7 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json
@@ -1,11 +1,11 @@
{
- "commit": "1198b4b73bed8c941a51acb037f1531166aa6728",
+ "commit": "8f973e94e1b24e4b14bc984491712191538944d3",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.4.8",
"@autorest/modelerfour@4.24.3"
],
- "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 --use=@autorest/python@6.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
+ "autorest_command": "autorest specification/apimanagement/resource-manager/readme.md --generate-sample=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.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.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 1c6cf3dbbf86..82e920873f93 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
@@ -80,7 +80,9 @@
PortalRevisionOperations,
PortalSettingsOperations,
PrivateEndpointConnectionOperations,
+ ProductApiLinkOperations,
ProductApiOperations,
+ ProductGroupLinkOperations,
ProductGroupOperations,
ProductOperations,
ProductPolicyOperations,
@@ -94,7 +96,10 @@
SignInSettingsOperations,
SignUpSettingsOperations,
SubscriptionOperations,
+ TagApiLinkOperations,
+ TagOperationLinkOperations,
TagOperations,
+ TagProductLinkOperations,
TagResourceOperations,
TenantAccessGitOperations,
TenantAccessOperations,
@@ -105,6 +110,34 @@
UserIdentitiesOperations,
UserOperations,
UserSubscriptionOperations,
+ WorkspaceApiExportOperations,
+ WorkspaceApiOperationOperations,
+ WorkspaceApiOperationPolicyOperations,
+ WorkspaceApiOperations,
+ WorkspaceApiPolicyOperations,
+ WorkspaceApiReleaseOperations,
+ WorkspaceApiRevisionOperations,
+ WorkspaceApiSchemaOperations,
+ WorkspaceApiVersionSetOperations,
+ WorkspaceGlobalSchemaOperations,
+ WorkspaceGroupOperations,
+ WorkspaceGroupUserOperations,
+ WorkspaceNamedValueOperations,
+ WorkspaceNotificationOperations,
+ WorkspaceNotificationRecipientEmailOperations,
+ WorkspaceNotificationRecipientUserOperations,
+ WorkspaceOperations,
+ WorkspacePolicyFragmentOperations,
+ WorkspacePolicyOperations,
+ WorkspaceProductApiLinkOperations,
+ WorkspaceProductGroupLinkOperations,
+ WorkspaceProductOperations,
+ WorkspaceProductPolicyOperations,
+ WorkspaceSubscriptionOperations,
+ WorkspaceTagApiLinkOperations,
+ WorkspaceTagOperationLinkOperations,
+ WorkspaceTagOperations,
+ WorkspaceTagProductLinkOperations,
)
if TYPE_CHECKING:
@@ -161,9 +194,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
@@ -175,6 +205,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
@@ -198,6 +231,8 @@ 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 gateway: GatewayOperations operations
@@ -275,6 +310,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
@@ -294,6 +333,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
@@ -312,16 +357,90 @@ 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: 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
: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.
: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 "2022-09-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.
@@ -376,9 +495,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
)
@@ -389,6 +505,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)
@@ -407,6 +526,7 @@ 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.gateway = GatewayOperations(self._client, self._config, self._serialize, self._deserialize)
self.gateway_hostname_configuration = GatewayHostnameConfigurationOperations(
@@ -463,6 +583,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
)
@@ -478,6 +602,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
@@ -494,7 +623,82 @@ 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 = 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
+ )
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
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 482c605f60f0..2c8f74befe2c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py
@@ -29,14 +29,14 @@ class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-ma
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. 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 "2022-09-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:
super(ApiManagementClientConfiguration, self).__init__(**kwargs)
- api_version: str = kwargs.pop("api_version", "2022-08-01")
+ api_version: str = kwargs.pop("api_version", "2022-09-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/_version.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py
index 77f53a3589c6..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.0"
+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 8e1734ebd7c6..df173d6c0368 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
@@ -80,7 +80,9 @@
PortalRevisionOperations,
PortalSettingsOperations,
PrivateEndpointConnectionOperations,
+ ProductApiLinkOperations,
ProductApiOperations,
+ ProductGroupLinkOperations,
ProductGroupOperations,
ProductOperations,
ProductPolicyOperations,
@@ -94,7 +96,10 @@
SignInSettingsOperations,
SignUpSettingsOperations,
SubscriptionOperations,
+ TagApiLinkOperations,
+ TagOperationLinkOperations,
TagOperations,
+ TagProductLinkOperations,
TagResourceOperations,
TenantAccessGitOperations,
TenantAccessOperations,
@@ -105,6 +110,34 @@
UserIdentitiesOperations,
UserOperations,
UserSubscriptionOperations,
+ WorkspaceApiExportOperations,
+ WorkspaceApiOperationOperations,
+ WorkspaceApiOperationPolicyOperations,
+ WorkspaceApiOperations,
+ WorkspaceApiPolicyOperations,
+ WorkspaceApiReleaseOperations,
+ WorkspaceApiRevisionOperations,
+ WorkspaceApiSchemaOperations,
+ WorkspaceApiVersionSetOperations,
+ WorkspaceGlobalSchemaOperations,
+ WorkspaceGroupOperations,
+ WorkspaceGroupUserOperations,
+ WorkspaceNamedValueOperations,
+ WorkspaceNotificationOperations,
+ WorkspaceNotificationRecipientEmailOperations,
+ WorkspaceNotificationRecipientUserOperations,
+ WorkspaceOperations,
+ WorkspacePolicyFragmentOperations,
+ WorkspacePolicyOperations,
+ WorkspaceProductApiLinkOperations,
+ WorkspaceProductGroupLinkOperations,
+ WorkspaceProductOperations,
+ WorkspaceProductPolicyOperations,
+ WorkspaceSubscriptionOperations,
+ WorkspaceTagApiLinkOperations,
+ WorkspaceTagOperationLinkOperations,
+ WorkspaceTagOperations,
+ WorkspaceTagProductLinkOperations,
)
if TYPE_CHECKING:
@@ -164,9 +197,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
@@ -178,6 +208,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
@@ -201,6 +234,8 @@ 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 gateway: GatewayOperations operations
@@ -280,6 +315,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
@@ -301,6 +340,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
@@ -319,16 +364,94 @@ 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: 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
: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.
: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 "2022-09-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.
@@ -383,9 +506,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
)
@@ -396,6 +516,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)
@@ -414,6 +537,7 @@ 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.gateway = GatewayOperations(self._client, self._config, self._serialize, self._deserialize)
self.gateway_hostname_configuration = GatewayHostnameConfigurationOperations(
@@ -470,6 +594,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
)
@@ -485,6 +613,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
@@ -501,7 +634,82 @@ 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 = 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
+ )
def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
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 b5324d50cf8e..c22860e3bcc8 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
@@ -29,14 +29,14 @@ class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-ma
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. 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 "2022-09-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:
super(ApiManagementClientConfiguration, self).__init__(**kwargs)
- api_version: str = kwargs.pop("api_version", "2022-08-01")
+ api_version: str = kwargs.pop("api_version", "2022-09-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/operations/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py
index b22d1486cf46..feb24671886f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py
@@ -27,11 +27,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,6 +43,7 @@
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 ._gateway_operations import GatewayOperations
from ._gateway_hostname_configuration_operations import GatewayHostnameConfigurationOperations
@@ -77,6 +78,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 +89,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,7 +100,34 @@
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_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 ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@@ -122,11 +155,11 @@
"ApiWikisOperations",
"ApiExportOperations",
"ApiVersionSetOperations",
- "AuthorizationServerOperations",
"AuthorizationProviderOperations",
"AuthorizationOperations",
"AuthorizationLoginLinksOperations",
"AuthorizationAccessPolicyOperations",
+ "AuthorizationServerOperations",
"BackendOperations",
"CacheOperations",
"CertificateOperations",
@@ -138,6 +171,7 @@
"ApiManagementServiceSkusOperations",
"ApiManagementServiceOperations",
"DiagnosticOperations",
+ "DocumentationOperations",
"EmailTemplateOperations",
"GatewayOperations",
"GatewayHostnameConfigurationOperations",
@@ -172,6 +206,8 @@
"ProductPolicyOperations",
"ProductWikiOperations",
"ProductWikisOperations",
+ "ProductApiLinkOperations",
+ "ProductGroupLinkOperations",
"QuotaByCounterKeysOperations",
"QuotaByPeriodKeysOperations",
"RegionOperations",
@@ -181,6 +217,9 @@
"ApiManagementSkusOperations",
"SubscriptionOperations",
"TagResourceOperations",
+ "TagApiLinkOperations",
+ "TagOperationLinkOperations",
+ "TagProductLinkOperations",
"TenantAccessOperations",
"TenantAccessGitOperations",
"TenantConfigurationOperations",
@@ -189,7 +228,34 @@
"UserSubscriptionOperations",
"UserIdentitiesOperations",
"UserConfirmationPasswordOperations",
- "DocumentationOperations",
+ "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",
]
__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/_api_management_client_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_client_operations.py
index d0f344bf2423..997269f5796c 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
@@ -93,11 +93,15 @@ async def _perform_connectivity_check_async_initial( # pylint: disable=name-too
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
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 b6dbb6c33eb0..989ec158f266 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
@@ -375,7 +375,7 @@ async def _backup_initial(
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"))
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -841,11 +841,15 @@ async def _update_initial(
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"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -1119,11 +1123,14 @@ async def _delete_initial(
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("ApiManagementServiceResource", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -1177,9 +1184,13 @@ async def begin_delete(
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("ApiManagementServiceResource", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
if polling is True:
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 900226c8a735..1b4f7545039f 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
@@ -400,6 +400,9 @@ async def _create_or_update_initial(
deserialized = self._deserialize("ApiContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 163408db9d4c..ec9d5453a553 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
@@ -402,6 +402,9 @@ async def _create_or_update_initial(
deserialized = self._deserialize("SchemaContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 360c009d8ae2..5f7135042daa 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
@@ -386,6 +386,9 @@ async def _create_or_update_initial(
deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 8e5625834c73..406b135db3ff 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
@@ -397,6 +397,9 @@ async def _create_or_update_initial(
deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -657,6 +660,9 @@ async def _update_initial(
deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -1037,6 +1043,9 @@ async def _refresh_secret_initial(
deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 deee5de871a1..5a963eabb5d4 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
@@ -6,8 +6,10 @@
# 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, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import urllib.parse
+from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
@@ -20,6 +22,7 @@
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -60,8 +63,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,
@@ -70,7 +73,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,10 +95,18 @@ async def list_by_service(
:param skip: Number of records to skip. Default value is None.
:type skip: int
:keyword callable cls: A custom type or function that will be passed the direct response
- :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:
"""
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = 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 = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -104,46 +115,67 @@ async def list_by_service(
}
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,
- template_url=self.list_by_service.metadata["url"],
- 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
- )
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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, {})
+ return pipeline_response
- return deserialized
+ return AsyncItemPaged(get_next, extract_data)
list_by_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments"
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 d96b3603f7df..57755e1f064c 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
@@ -6,8 +6,10 @@
# 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, IO, Optional, TypeVar, Union, overload
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import urllib.parse
+from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
@@ -19,6 +21,7 @@
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -57,10 +60,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,10 +72,17 @@ async def list_by_service(
:param service_name: The name of the API Management service. Required.
:type service_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
- :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:
"""
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = 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 = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -81,42 +91,63 @@ async def list_by_service(
}
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,
- template_url=self.list_by_service.metadata["url"],
- 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, {})
-
- return deserialized
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
list_by_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies"
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 e82f6e989b99..f1fe75e5efa4 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
@@ -6,8 +6,10 @@
# 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, IO, Optional, TypeVar, Union, overload
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import urllib.parse
+from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
@@ -19,6 +21,7 @@
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -57,10 +60,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,10 +72,18 @@ async def list_by_service(
:param service_name: The name of the API Management service. Required.
:type service_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
- :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:
"""
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = 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)
+
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -81,42 +92,63 @@ async def list_by_service(
}
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,
- template_url=self.list_by_service.metadata["url"],
- 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, {})
-
- return deserialized
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
list_by_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs"
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 fb55aa5e9abf..6a675053b7ef 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
@@ -389,6 +389,9 @@ async def _create_or_update_initial(
deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -644,6 +647,9 @@ async def _update_initial(
deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 2908d03a1f91..ba323d6009c8 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
@@ -285,11 +285,15 @@ async def _create_or_update_initial(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -508,8 +512,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
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, {})
+ return cls(pipeline_response, None, response_headers)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}"
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..97ae77f71d7e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_link_operations.py
@@ -0,0 +1,495 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}"
+ }
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..8195afc8b323
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_link_operations.py
@@ -0,0 +1,495 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}"
+ }
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 98c695d56231..3a7e4057f59c 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
@@ -6,8 +6,10 @@
# 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, IO, Optional, TypeVar, Union, overload
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+import urllib.parse
+from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
@@ -19,6 +21,7 @@
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -57,10 +60,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,10 +75,17 @@ async def list_by_product(
instance. Required.
:type product_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
- :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:
"""
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = 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 = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -84,43 +94,64 @@ async def list_by_product(
}
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,
- template_url=self.list_by_product.metadata["url"],
- 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, {})
-
- return deserialized
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
list_by_product.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies"
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..4916a94b57a8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_api_link_operations.py
@@ -0,0 +1,494 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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_api_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
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..c869c67644b0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operation_link_operations.py
@@ -0,0 +1,495 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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_operation_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
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..53f2c5dd0133
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_product_link_operations.py
@@ -0,0 +1,495 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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_product_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}"
+ }
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 b0d43e415e6d..05d450ab9dc9 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
@@ -118,11 +118,15 @@ async def _deploy_initial(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -377,11 +381,15 @@ async def _save_initial(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -636,11 +644,15 @@ async def _validate_initial(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
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..349bebd92a87
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_export_operations.py
@@ -0,0 +1,141 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_api_export_operations import build_get_request
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiExportResult or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiExportResult
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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("ApiExportResult", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
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..eeb0357f306e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_operations.py
@@ -0,0 +1,846 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_api.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("OperationCollection", pipeline_response)
+ 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)
+
+ list_by_api.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("OperationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("OperationContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("OperationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("OperationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
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..634d787c444e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_policy_operations.py
@@ -0,0 +1,656 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_operation.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_operation.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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 = case_insensitive_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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"
+ }
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..59e19369ac42
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operations.py
@@ -0,0 +1,901 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ 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],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.ApiContract]:
+ error_map = {
+ 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[Optional[_models.ApiContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ deserialized = None
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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],
+ 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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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
+ )
+ 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("ApiContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
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..253d0b66dec0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_policy_operations.py
@@ -0,0 +1,618 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_api.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_api.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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 = case_insensitive_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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"
+ }
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..458ffdd5ba62
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_release_operations.py
@@ -0,0 +1,840 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiReleaseCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
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..394e1cf1f71f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_revision_operations.py
@@ -0,0 +1,175 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import 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._workspace_api_revision_operations import build_list_by_service_request
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiRevisionCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/revisions"
+ }
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..e58d977a00a8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_schema_operations.py
@@ -0,0 +1,731 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_api.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("SchemaCollection", pipeline_response)
+ 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)
+
+ list_by_api.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SchemaContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SchemaContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
+
+ 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],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.SchemaContract]:
+ error_map = {
+ 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[Optional[_models.SchemaContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ deserialized = None
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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
+ )
+ 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("SchemaContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
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..2144ee9fda8c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_version_set_operations.py
@@ -0,0 +1,782 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiVersionSetCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
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..49de264b70db
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_global_schema_operations.py
@@ -0,0 +1,700 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("GlobalSchemaCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GlobalSchemaContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
+
+ 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],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.GlobalSchemaContract]:
+ error_map = {
+ 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[Optional[_models.GlobalSchemaContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ deserialized = None
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either GlobalSchemaContract or the result
+ of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: IO,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either GlobalSchemaContract or the result
+ of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @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],
+ 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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either GlobalSchemaContract or the result
+ of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_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
+ )
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ response_headers = {}
+ response = pipeline_response.http_response
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ return deserialized
+
+ if polling is True:
+ polling_method: 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
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..799dfdd01c8d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_group_operations.py
@@ -0,0 +1,786 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("GroupCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GroupContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GroupContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GroupContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GroupContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
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..d6f590efa599
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_group_user_operations.py
@@ -0,0 +1,412 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_group_user_operations import (
+ build_check_entity_exists_request,
+ build_create_request,
+ build_delete_request,
+ build_list_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("UserCollection", pipeline_response)
+ 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)
+
+ list.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.check_entity_exists.metadata["url"],
+ 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 [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, {})
+ return 200 <= response.status_code <= 299
+
+ check_entity_exists.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: UserContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.UserContract
+ :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.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,
+ template_url=self.create.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("UserContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("UserContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}"
+ }
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..8db799219f49
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_named_value_operations.py
@@ -0,0 +1,1196 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("NamedValueCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: NamedValueContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NamedValueContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ 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],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.NamedValueContract]:
+ error_map = {
+ 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[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ deserialized = None
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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
+ )
+ 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)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ 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],
+ **kwargs: Any
+ ) -> Optional[_models.NamedValueContract]:
+ error_map = {
+ 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[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._update_initial.metadata["url"],
+ 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, 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)
+
+ 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"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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],
+ **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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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
+ )
+ 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)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: NamedValueSecretContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NamedValueSecretContract
+ :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.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,
+ template_url=self.list_value.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("NamedValueSecretContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ list_value.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/listValue"
+ }
+
+ async def _refresh_secret_initial(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> Optional[_models.NamedValueContract]:
+ 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[Optional[_models.NamedValueContract]] = 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,
+ template_url=self._refresh_secret_initial.metadata["url"],
+ 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, 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)
+
+ 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"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _refresh_secret_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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
+ )
+ 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)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_refresh_secret.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret"
+ }
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..335d6b606415
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_operations.py
@@ -0,0 +1,334 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_notification_operations import (
+ build_create_or_update_request,
+ build_get_request,
+ build_list_by_service_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("NotificationCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: NotificationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NotificationContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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("NotificationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: NotificationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NotificationContract
+ :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.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,
+ template_url=self.create_or_update.metadata["url"],
+ 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("NotificationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}"
+ }
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..b2945373c53f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_recipient_email_operations.py
@@ -0,0 +1,386 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_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
+
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceNotificationRecipientEmailOperations:
+ """
+ .. 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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: RecipientEmailCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailCollection
+ :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.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,
+ template_url=self.list_by_notification.metadata["url"],
+ 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("RecipientEmailCollection", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_by_notification.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.check_entity_exists.metadata["url"],
+ 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 [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, {})
+ return 200 <= response.status_code <= 299
+
+ check_entity_exists.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: RecipientEmailContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailContract
+ :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.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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("RecipientEmailContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("RecipientEmailContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}"
+ }
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..23e614a39cce
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_notification_recipient_user_operations.py
@@ -0,0 +1,389 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_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
+
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class WorkspaceNotificationRecipientUserOperations:
+ """
+ .. 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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: RecipientUserCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientUserCollection
+ :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.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,
+ template_url=self.list_by_notification.metadata["url"],
+ 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("RecipientUserCollection", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_by_notification.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.check_entity_exists.metadata["url"],
+ 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 [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, {})
+ return 200 <= response.status_code <= 299
+
+ check_entity_exists.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: RecipientUserContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientUserContract
+ :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.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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("RecipientUserContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("RecipientUserContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}"
+ }
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..bcbccf5f04c7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_operations.py
@@ -0,0 +1,734 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("WorkspaceContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("WorkspaceContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("WorkspaceContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("WorkspaceContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
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..6d7d110c89b1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_policy_fragment_operations.py
@@ -0,0 +1,787 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyFragmentContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ async def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: Union[_models.PolicyFragmentContract, IO],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.PolicyFragmentContract]:
+ error_map = {
+ 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[Optional[_models.PolicyFragmentContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ 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)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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],
+ 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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either 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
+ )
+ 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("PolicyFragmentContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ResourceCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ResourceCollection
+ :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.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,
+ template_url=self.list_references.metadata["url"],
+ 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("ResourceCollection", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_references.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}/listReferences"
+ }
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..8dd888789a16
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_policy_operations.py
@@ -0,0 +1,586 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_api.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_api.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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 = case_insensitive_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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"
+ }
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..c47b25d1272d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_api_link_operations.py
@@ -0,0 +1,533 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_product_api_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}"
+ }
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..40513572e000
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_group_link_operations.py
@@ -0,0 +1,533 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_product_group_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}"
+ }
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..8bb7787cee20
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_operations.py
@@ -0,0 +1,800 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
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..d6d9d7162c9c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_policy_operations.py
@@ -0,0 +1,587 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, TypeVar, Union, overload
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
+ :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,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ template_url=self.list_by_product.metadata["url"],
+ 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, {})
+
+ return deserialized
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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 = case_insensitive_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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"
+ }
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..57ca12fd88d0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_subscription_operations.py
@@ -0,0 +1,1080 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("SubscriptionCollection", pipeline_response)
+ 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)
+
+ list.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.regenerate_primary_key.metadata["url"],
+ 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 [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, {})
+
+ regenerate_primary_key.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regeneratePrimaryKey"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.regenerate_secondary_key.metadata["url"],
+ 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 [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, {})
+
+ regenerate_secondary_key.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regenerateSecondaryKey"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SubscriptionKeysContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionKeysContract
+ :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.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,
+ template_url=self.list_secrets.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionKeysContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ list_secrets.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/listSecrets"
+ }
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..035437d4f3b0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_api_link_operations.py
@@ -0,0 +1,532 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_tag_api_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
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..5c68353ca4b1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operation_link_operations.py
@@ -0,0 +1,533 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_tag_operation_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
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..9c96c378da1b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operations.py
@@ -0,0 +1,780 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._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,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_state.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_state.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
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..399c3d82325d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_product_link_operations.py
@@ -0,0 +1,533 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, 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.pipeline.transport import AsyncHttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.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._workspace_tag_product_link_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_by_product_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}"
+ }
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..04fc245628b4 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
@@ -87,6 +87,7 @@
from ._models_py3 import AuthorizationServerUpdateContractProperties
from ._models_py3 import BackendAuthorizationHeaderCredentials
from ._models_py3 import BackendBaseParameters
+from ._models_py3 import BackendCircuitBreaker
from ._models_py3 import BackendCollection
from ._models_py3 import BackendContract
from ._models_py3 import BackendContractProperties
@@ -107,6 +108,8 @@
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 ConnectivityCheckRequest
from ._models_py3 import ConnectivityCheckRequestDestination
@@ -140,6 +143,7 @@
from ._models_py3 import ErrorFieldContract
from ._models_py3 import ErrorResponse
from ._models_py3 import ErrorResponseBody
+from ._models_py3 import FailureStatusCodeRange
from ._models_py3 import GatewayCertificateAuthorityCollection
from ._models_py3 import GatewayCertificateAuthorityContract
from ._models_py3 import GatewayCollection
@@ -250,10 +254,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 +312,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 +322,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,6 +352,8 @@
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 X509CertificateName
from ._api_management_client_enums import AccessIdName
@@ -378,6 +394,7 @@
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 LoggerType
from ._api_management_client_enums import Method
from ._api_management_client_enums import NameAvailabilityReason
@@ -501,6 +518,7 @@
"AuthorizationServerUpdateContractProperties",
"BackendAuthorizationHeaderCredentials",
"BackendBaseParameters",
+ "BackendCircuitBreaker",
"BackendCollection",
"BackendContract",
"BackendContractProperties",
@@ -521,6 +539,8 @@
"CertificateContract",
"CertificateCreateOrUpdateParameters",
"CertificateInformation",
+ "CircuitBreakerFailureCondition",
+ "CircuitBreakerRule",
"ClientSecretContract",
"ConnectivityCheckRequest",
"ConnectivityCheckRequestDestination",
@@ -554,6 +574,7 @@
"ErrorFieldContract",
"ErrorResponse",
"ErrorResponseBody",
+ "FailureStatusCodeRange",
"GatewayCertificateAuthorityCollection",
"GatewayCertificateAuthorityContract",
"GatewayCollection",
@@ -664,10 +685,14 @@
"PrivateLinkResource",
"PrivateLinkResourceListResult",
"PrivateLinkServiceConnectionState",
+ "ProductApiLinkCollection",
+ "ProductApiLinkContract",
"ProductCollection",
"ProductContract",
"ProductContractProperties",
"ProductEntityBaseParameters",
+ "ProductGroupLinkCollection",
+ "ProductGroupLinkContract",
"ProductTagResourceContractProperties",
"ProductUpdateParameters",
"ProductUpdateProperties",
@@ -718,6 +743,8 @@
"SubscriptionUpdateParameters",
"SubscriptionsDelegationSettingsProperties",
"SystemData",
+ "TagApiLinkCollection",
+ "TagApiLinkContract",
"TagCollection",
"TagContract",
"TagCreateUpdateParameters",
@@ -726,6 +753,10 @@
"TagDescriptionContract",
"TagDescriptionContractProperties",
"TagDescriptionCreateParameters",
+ "TagOperationLinkCollection",
+ "TagOperationLinkContract",
+ "TagProductLinkCollection",
+ "TagProductLinkContract",
"TagResourceCollection",
"TagResourceContract",
"TagResourceContractProperties",
@@ -752,6 +783,8 @@
"WikiContract",
"WikiDocumentationContract",
"WikiUpdateContract",
+ "WorkspaceCollection",
+ "WorkspaceContract",
"X509CertificateName",
"AccessIdName",
"AccessType",
@@ -791,6 +824,7 @@
"IdentityProviderType",
"IssueType",
"KeyType",
+ "KeyVaultRefreshState",
"LoggerType",
"Method",
"NameAvailabilityReason",
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 85270529ff70..15cd4bc9c621 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
@@ -392,6 +392,15 @@ 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 LoggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Logger type."""
@@ -492,6 +501,8 @@ 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 PolicyContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta):
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 6fc753739c3c..83429de2653d 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
@@ -357,7 +357,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
"""
@@ -2092,7 +2092,7 @@ 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
"""
@@ -2611,7 +2611,7 @@ 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 publisher_email: Publisher email. Required.
:vartype publisher_email: str
@@ -2977,7 +2977,7 @@ 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 publisher_email: Publisher email. Required.
:vartype publisher_email: str
@@ -3386,7 +3386,7 @@ 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 publisher_email: Publisher email.
:vartype publisher_email: str
@@ -3734,7 +3734,7 @@ 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 publisher_email: Publisher email.
:vartype publisher_email: str
@@ -7004,6 +7004,8 @@ 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
"""
_validation = {
@@ -7020,6 +7022,7 @@ 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"},
}
def __init__(
@@ -7032,6 +7035,7 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
**kwargs: Any
) -> None:
"""
@@ -7050,6 +7054,8 @@ 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
"""
super().__init__(**kwargs)
self.title = title
@@ -7059,6 +7065,31 @@ def __init__(
self.credentials = credentials
self.proxy = proxy
self.tls = tls
+ self.circuit_breaker = circuit_breaker
+
+
+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):
@@ -7128,6 +7159,8 @@ 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 url: Runtime Url of the Backend.
:vartype url: str
:ivar protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7155,6 +7188,7 @@ 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"},
"url": {"key": "properties.url", "type": "str"},
"protocol": {"key": "properties.protocol", "type": "str"},
}
@@ -7169,6 +7203,7 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
url: Optional[str] = None,
protocol: Optional[Union[str, "_models.BackendProtocol"]] = None,
**kwargs: Any
@@ -7189,6 +7224,8 @@ 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 url: Runtime Url of the Backend.
:paramtype url: str
:keyword protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7202,6 +7239,7 @@ def __init__(
self.credentials = credentials
self.proxy = proxy
self.tls = tls
+ self.circuit_breaker = circuit_breaker
self.url = url
self.protocol = protocol
@@ -7226,6 +7264,8 @@ 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 url: Runtime Url of the Backend. Required.
:vartype url: str
:ivar protocol: Backend communication protocol. Required. Known values are: "http" and "soap".
@@ -7248,6 +7288,7 @@ class BackendContractProperties(BackendBaseParameters):
"credentials": {"key": "credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "proxy", "type": "BackendProxyContract"},
"tls": {"key": "tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"},
"url": {"key": "url", "type": "str"},
"protocol": {"key": "protocol", "type": "str"},
}
@@ -7264,6 +7305,7 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
**kwargs: Any
) -> None:
"""
@@ -7282,6 +7324,8 @@ 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 url: Runtime Url of the Backend. Required.
:paramtype url: str
:keyword protocol: Backend communication protocol. Required. Known values are: "http" and
@@ -7296,6 +7340,7 @@ def __init__(
credentials=credentials,
proxy=proxy,
tls=tls,
+ circuit_breaker=circuit_breaker,
**kwargs
)
self.url = url
@@ -7592,6 +7637,8 @@ 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 url: Runtime Url of the Backend.
:vartype url: str
:ivar protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7613,6 +7660,7 @@ class BackendUpdateParameterProperties(BackendBaseParameters):
"credentials": {"key": "credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "proxy", "type": "BackendProxyContract"},
"tls": {"key": "tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"},
"url": {"key": "url", "type": "str"},
"protocol": {"key": "protocol", "type": "str"},
}
@@ -7627,6 +7675,7 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
url: Optional[str] = None,
protocol: Optional[Union[str, "_models.BackendProtocol"]] = None,
**kwargs: Any
@@ -7647,6 +7696,8 @@ 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 url: Runtime Url of the Backend.
:paramtype url: str
:keyword protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7660,6 +7711,7 @@ def __init__(
credentials=credentials,
proxy=proxy,
tls=tls,
+ circuit_breaker=circuit_breaker,
**kwargs
)
self.url = url
@@ -7684,6 +7736,8 @@ 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 url: Runtime Url of the Backend.
:vartype url: str
:ivar protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7705,6 +7759,7 @@ 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"},
"url": {"key": "properties.url", "type": "str"},
"protocol": {"key": "properties.protocol", "type": "str"},
}
@@ -7719,6 +7774,7 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
url: Optional[str] = None,
protocol: Optional[Union[str, "_models.BackendProtocol"]] = None,
**kwargs: Any
@@ -7739,6 +7795,8 @@ 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 url: Runtime Url of the Backend.
:paramtype url: str
:keyword protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7752,6 +7810,7 @@ def __init__(
self.credentials = credentials
self.proxy = proxy
self.tls = tls
+ self.circuit_breaker = circuit_breaker
self.url = url
self.protocol = protocol
@@ -8189,6 +8248,103 @@ def __init__(self, *, expiry: datetime.datetime, thumbprint: str, subject: str,
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
+ """
+
+ _attribute_map = {
+ "name": {"key": "name", "type": "str"},
+ "failure_condition": {"key": "failureCondition", "type": "CircuitBreakerFailureCondition"},
+ "trip_duration": {"key": "tripDuration", "type": "duration"},
+ }
+
+ def __init__(
+ self,
+ *,
+ name: Optional[str] = None,
+ failure_condition: Optional["_models.CircuitBreakerFailureCondition"] = None,
+ trip_duration: Optional[datetime.timedelta] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :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
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.failure_condition = failure_condition
+ self.trip_duration = trip_duration
+
+
class ClientSecretContract(_serialization.Model):
"""Client or app secret used in IdentityProviders, Aad, OpenID or OAuth.
@@ -9667,6 +9823,43 @@ def __init__(
self.details = details
+class FailureStatusCodeRange(_serialization.Model):
+ """The failure http status code range.
+
+ :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 = {
+ "min": {"key": "min", "type": "int"},
+ "max": {"key": "max", "type": "int"},
+ }
+
+ def __init__(
+ self,
+ *,
+ min: Optional[int] = None, # pylint: disable=redefined-builtin
+ max: Optional[int] = None, # pylint: disable=redefined-builtin
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword min: The minimum http status code.
+ :paramtype min: int
+ :keyword max: The maximum http status code.
+ :paramtype max: int
+ """
+ super().__init__(**kwargs)
+ self.min = min
+ self.max = max
+
+
class GatewayCertificateAuthorityCollection(_serialization.Model):
"""Paged Gateway certificate authority list representation.
@@ -15595,6 +15788,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}.
+ :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.
@@ -15946,6 +16217,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}.
+ :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.
@@ -18674,6 +19023,84 @@ def __init__(
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}.
+ :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 TagCollection(_serialization.Model):
"""Paged Tag list representation.
@@ -19036,6 +19463,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}.
+ :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}.
+ :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.
@@ -20308,6 +20891,90 @@ 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}.
+ :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 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..feb24671886f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py
@@ -27,11 +27,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,6 +43,7 @@
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 ._gateway_operations import GatewayOperations
from ._gateway_hostname_configuration_operations import GatewayHostnameConfigurationOperations
@@ -77,6 +78,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 +89,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,7 +100,34 @@
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_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 ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
@@ -122,11 +155,11 @@
"ApiWikisOperations",
"ApiExportOperations",
"ApiVersionSetOperations",
- "AuthorizationServerOperations",
"AuthorizationProviderOperations",
"AuthorizationOperations",
"AuthorizationLoginLinksOperations",
"AuthorizationAccessPolicyOperations",
+ "AuthorizationServerOperations",
"BackendOperations",
"CacheOperations",
"CertificateOperations",
@@ -138,6 +171,7 @@
"ApiManagementServiceSkusOperations",
"ApiManagementServiceOperations",
"DiagnosticOperations",
+ "DocumentationOperations",
"EmailTemplateOperations",
"GatewayOperations",
"GatewayHostnameConfigurationOperations",
@@ -172,6 +206,8 @@
"ProductPolicyOperations",
"ProductWikiOperations",
"ProductWikisOperations",
+ "ProductApiLinkOperations",
+ "ProductGroupLinkOperations",
"QuotaByCounterKeysOperations",
"QuotaByPeriodKeysOperations",
"RegionOperations",
@@ -181,6 +217,9 @@
"ApiManagementSkusOperations",
"SubscriptionOperations",
"TagResourceOperations",
+ "TagApiLinkOperations",
+ "TagOperationLinkOperations",
+ "TagProductLinkOperations",
"TenantAccessOperations",
"TenantAccessGitOperations",
"TenantConfigurationOperations",
@@ -189,7 +228,34 @@
"UserSubscriptionOperations",
"UserIdentitiesOperations",
"UserConfirmationPasswordOperations",
- "DocumentationOperations",
+ "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",
]
__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/_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_diagnostic_operations.py
index ac3816847698..aa453cfed1e4 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
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -141,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -192,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -248,7 +248,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -303,7 +303,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 4577d34f8ffc..806fb9fb366a 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
@@ -47,7 +47,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 e83aae5ef571..c95f95625b38 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
@@ -51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -107,7 +107,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -160,7 +160,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -215,7 +215,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -275,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 82884bb9b349..f7a531a06a4b 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
@@ -51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -107,7 +107,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -160,7 +160,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -215,7 +215,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -275,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 d0516701505d..ed8b88c5f787 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
@@ -51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -102,7 +102,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -153,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -208,7 +208,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -264,7 +264,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -319,7 +319,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 d3497caf1643..48f9cb192627 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
@@ -42,7 +42,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -138,11 +138,15 @@ def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("ConnectivityCheckResponse", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
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 848cee0fc764..8be3e4212a17 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 b877c4f56dd7..592e0a451e10 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
@@ -44,7 +44,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -87,7 +87,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -130,7 +130,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -173,7 +173,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -214,7 +214,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -254,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -294,7 +294,7 @@ 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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -332,7 +332,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -362,7 +362,7 @@ 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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -388,7 +388,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -426,7 +426,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -457,7 +457,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -485,7 +485,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -846,7 +846,7 @@ def _backup_initial(
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"))
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -1312,11 +1312,15 @@ def _update_initial(
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"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -1588,11 +1592,14 @@ def _delete_initial(
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("ApiManagementServiceResource", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -1646,9 +1653,13 @@ def begin_delete(
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("ApiManagementServiceResource", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
if polling is True:
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 f7664828c143..e8960342646e 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 03a09b61a5bc..9ad765aaf7a5 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
@@ -40,7 +40,7 @@ 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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 5605a6f1ebfc..94b3c8ca42dd 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
@@ -51,7 +51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -100,7 +100,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -142,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -191,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -245,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -298,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 6e55c32f30cf..62f0739ab83a 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -88,7 +88,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -139,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -192,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -248,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 e9331ff4cf3c..531feb28c3d9 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
@@ -53,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -103,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -144,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -191,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -237,7 +237,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -289,7 +289,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -341,7 +341,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -738,6 +738,9 @@ def _create_or_update_initial(
deserialized = self._deserialize("ApiContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 4bf7acd3ae85..be2d2dc37cb8 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -86,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -135,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", "2022-09-01-preview"))
accept = _headers.pop(
"Accept",
"application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml",
@@ -189,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -243,7 +243,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 fd4c86eb0428..369c40e463d8 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 9942c64de602..4daf1edde2a5 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
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -141,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -192,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -248,7 +248,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -303,7 +303,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 b6c5dfb95f24..3d5284039c52 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
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 e473da408753..b10465002cf9 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
@@ -52,7 +52,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -99,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -141,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -190,7 +190,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -245,7 +245,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -642,6 +642,9 @@ def _create_or_update_initial(
deserialized = self._deserialize("SchemaContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 f6f78afa2c75..84e08a7bceab 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
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -102,7 +102,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -151,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -202,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -258,7 +258,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 dae7fab81f48..ce031e6d3d42 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -138,7 +138,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -187,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -241,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -294,7 +294,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 f46e90fe19d3..4efc2cc51ccb 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -81,7 +81,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -128,7 +128,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -174,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -219,7 +219,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 88256450d32d..2df055a52ab1 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 94fe11ba5c21..8cd9b86352de 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
@@ -51,7 +51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -114,7 +114,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -181,7 +181,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -253,7 +253,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 c1c1b39cf0a1..df6b26b86918 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
@@ -45,7 +45,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
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 5d66ea640444..1774b762d301 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,7 +109,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -167,7 +167,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -230,7 +230,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -287,7 +287,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
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 d30a99286adb..659f71920f68 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -149,7 +149,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -208,7 +208,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 10cf9385f01c..4cffeb2d03c5 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -136,7 +136,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -183,7 +183,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -229,7 +229,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -274,7 +274,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -316,7 +316,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 72c1a14843fc..de6c8dc82672 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -136,7 +136,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -183,7 +183,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -229,7 +229,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -274,7 +274,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -316,7 +316,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
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 7852c4175aa7..c9f0076d7645 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
@@ -48,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -92,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -133,7 +133,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -180,7 +180,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -226,7 +226,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -271,7 +271,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 f934454b73d6..f34f47154879 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
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -100,7 +100,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -143,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -192,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -246,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -290,7 +290,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 40379b3a296a..2236c64c168d 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -88,7 +88,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -135,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -184,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -238,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 0f784cd8fe37..49dab856dc20 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -82,7 +82,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -129,7 +129,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -181,7 +181,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 13ad5d3897ae..a270893aaac4 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -78,7 +78,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -118,7 +118,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -162,7 +162,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -207,7 +207,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 6529c57d6089..baa107311c80 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -68,7 +68,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -104,7 +104,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 43836334bb96..02d9cfd14b5f 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -138,7 +138,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -187,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -241,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -294,7 +294,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 095fdf554303..450f0109f8b5 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -138,7 +138,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -187,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -241,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -294,7 +294,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 66b7d1020e85..b1803006385e 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -99,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -144,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -191,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -243,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -294,7 +294,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 60e7cb8fd4cd..9401ef8511cd 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
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -139,7 +139,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -184,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 1fd1cabaaa7e..beb3488893ea 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
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -102,7 +102,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -151,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -202,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -258,7 +258,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 025217ce6e92..c173f14f7bb8 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
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -139,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -188,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -242,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 94ec902d0db3..dedbcf4bd53f 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -136,7 +136,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -183,7 +183,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -229,7 +229,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -274,7 +274,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -316,7 +316,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -357,7 +357,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -401,7 +401,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
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 88e3e2dfe1c3..c48c94e2b9fd 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
@@ -51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -138,7 +138,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -185,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -231,7 +231,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -609,6 +609,9 @@ def _create_or_update_initial(
deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 ce2deecca4ef..ec2175a38c3d 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -139,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -188,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -242,7 +242,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -295,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 38e54b6b1cfa..c1710000f61a 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -90,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -141,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -194,7 +194,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -250,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 dd1c91211075..ac6e31de1d32 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -136,7 +136,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -183,7 +183,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -229,7 +229,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -274,7 +274,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 4862d8546ab8..b8f81ab60158 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -139,7 +139,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -181,7 +181,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 3757d032619a..0c9ed8ab7c45 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -86,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -131,7 +131,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -178,7 +178,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -230,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -281,7 +281,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -327,7 +327,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 b3374ea4e716..3505c0ddfa84 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 3031d6b996de..6eb224c7ffbb 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -136,7 +136,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -183,7 +183,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -229,7 +229,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -274,7 +274,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 ac9cf85e0c3e..739d73a3da03 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
@@ -52,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -102,7 +102,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -145,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -194,7 +194,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -248,7 +248,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -301,7 +301,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -345,7 +345,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -388,7 +388,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -773,6 +773,9 @@ def _create_or_update_initial(
deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -1033,6 +1036,9 @@ def _update_initial(
deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -1413,6 +1419,9 @@ def _refresh_secret_initial(
deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 b74d46c09b0c..49f12ec5ad0e 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -80,7 +80,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 3312995c192b..698cfa3232eb 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
@@ -48,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -96,7 +96,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -143,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 fd04a5ef7dc7..48fc7a45d9e2 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
@@ -44,7 +44,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -90,7 +90,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -137,7 +137,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -184,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 2031ae1e390c..dae6cdae34e9 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
@@ -44,7 +44,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -90,7 +90,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -137,7 +137,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -184,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 8622bd9d0fdd..289f80206f53 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -136,7 +136,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -183,7 +183,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -229,7 +229,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -274,7 +274,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -316,7 +316,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 1006c6d07690..a9971cd614a1 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
@@ -51,7 +51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 36d6bdb7e1f1..a315dc37d53d 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 4e445d47bd8c..0f0475392d8a 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
@@ -45,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 67d9da142320..ddc213e2e14e 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
@@ -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, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -16,6 +17,7 @@
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.polling import LROPoller, NoPolling, PollingMethod
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -98,7 +100,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -145,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -194,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -240,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -289,7 +291,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -357,7 +359,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,10 +381,17 @@ def list_by_service(
:param skip: Number of records to skip. Default value is None.
:type skip: int
:keyword callable cls: A custom type or function that will be passed the direct response
- :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:
"""
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = 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 = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -391,46 +400,67 @@ def list_by_service(
}
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,
- template_url=self.list_by_service.metadata["url"],
- 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
- )
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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, {})
+ return pipeline_response
- return deserialized
+ return ItemPaged(get_next, extract_data)
list_by_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments"
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 f2e58d85fb5a..94febc5f0a64 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
@@ -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, IO, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -16,6 +17,7 @@
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
@@ -40,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -84,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -131,7 +133,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -180,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -232,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -288,7 +290,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,10 +301,16 @@ def list_by_service(self, resource_group_name: str, service_name: str, **kwargs:
:param service_name: The name of the API Management service. Required.
:type service_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
- :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:
"""
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = 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 = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -309,42 +319,63 @@ def list_by_service(self, resource_group_name: str, service_name: str, **kwargs:
}
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,
- template_url=self.list_by_service.metadata["url"],
- 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, {})
-
- return deserialized
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
list_by_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies"
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 492a8e39bda3..5fba541b6492 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
@@ -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, IO, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -16,6 +17,7 @@
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
@@ -40,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -80,7 +82,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -121,7 +123,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -168,7 +170,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -219,7 +221,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -280,7 +282,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,10 +291,17 @@ def list_by_service(
:param service_name: The name of the API Management service. Required.
:type service_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
- :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:
"""
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = 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)
+
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -301,42 +310,63 @@ def list_by_service(
}
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,
- template_url=self.list_by_service.metadata["url"],
- 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, {})
-
- return deserialized
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
list_by_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs"
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 3c6f0509e881..b80b72fc8f25 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
@@ -51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -140,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -183,7 +183,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -235,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -621,6 +621,9 @@ def _create_or_update_initial(
deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -873,6 +876,9 @@ def _update_initial(
deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
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 6e7307b7c641..7ae2162628a8 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 c5e40739b4ef..90a0b3bc96a1 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
@@ -44,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -88,7 +88,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -135,7 +135,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -185,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -228,7 +228,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -272,7 +272,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -550,11 +550,15 @@ def _create_or_update_initial(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -773,8 +777,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
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, {})
+ return cls(pipeline_response, None, response_headers)
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}"
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..4a00e129fba4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_link_operations.py
@@ -0,0 +1,680 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}"
+ }
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 37220caf49ef..58fdaf86a5ca 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -139,7 +139,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -181,7 +181,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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..fae91749a7a2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_link_operations.py
@@ -0,0 +1,695 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}"
+ }
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 bcb3b225a4a7..dfb80a201e14 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -139,7 +139,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -181,7 +181,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 067ccf2ce519..58f09a466eb5 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
@@ -51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -101,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -142,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -189,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -235,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -287,7 +287,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -339,7 +339,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 c5d0a34d26ae..dcaa00a80cae 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
@@ -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, IO, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -16,6 +17,7 @@
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
@@ -40,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -86,7 +88,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -135,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -186,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -240,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -299,7 +301,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,10 +313,16 @@ def list_by_product(
instance. Required.
:type product_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
- :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:
"""
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = 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 = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -323,43 +331,64 @@ def list_by_product(
}
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,
- template_url=self.list_by_product.metadata["url"],
- 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, {})
-
- return deserialized
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
list_by_product.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies"
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 909bec7559df..6e5316d1b9d2 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 dc0685124f94..49e950e04caa 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -81,7 +81,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -128,7 +128,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -174,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -219,7 +219,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 e45df57ac751..52032fd1074b 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 576445a9ae17..605c2e17418c 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -81,7 +81,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
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 9bb1c968aa33..d9dac39cb621 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
@@ -45,7 +45,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -92,7 +92,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
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 39904e55326c..46a24e66c17a 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 8289b4dbf1ed..3438453d34a9 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
@@ -51,7 +51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -106,7 +106,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,7 +161,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -216,7 +216,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -270,7 +270,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -323,7 +323,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -379,7 +379,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -434,7 +434,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 2e05922652df..32d170e64bc9 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -78,7 +78,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -118,7 +118,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -162,7 +162,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
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 ebb72905705f..6471e38895a7 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
@@ -40,7 +40,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -78,7 +78,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -118,7 +118,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -162,7 +162,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
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 79bf51ab5cd7..2d3184d4b5b7 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,7 +95,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -136,7 +136,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -185,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -243,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -292,7 +292,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -334,7 +334,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -375,7 +375,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -416,7 +416,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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..944d340a6e05
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_api_link_operations.py
@@ -0,0 +1,679 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
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..bd11e529e070
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operation_link_operations.py
@@ -0,0 +1,695 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
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 e573e0d6cb21..7cf55d4988bb 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
@@ -51,7 +51,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -105,7 +105,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -154,7 +154,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -203,7 +203,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -252,7 +252,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -303,7 +303,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -350,7 +350,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -392,7 +392,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -434,7 +434,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -476,7 +476,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -526,7 +526,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -573,7 +573,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -615,7 +615,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -657,7 +657,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -699,7 +699,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -749,7 +749,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -797,7 +797,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -838,7 +838,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -885,7 +885,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -931,7 +931,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -976,7 +976,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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..6238e0626f73
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_product_link_operations.py
@@ -0,0 +1,680 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}"
+ }
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 7822da240133..4a69f326b9ce 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
@@ -49,7 +49,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 058d857b61b7..1cc20a35c83c 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
@@ -44,7 +44,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -89,7 +89,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 3a454f450d38..b6c4a33f0e2a 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -88,7 +88,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -133,7 +133,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -180,7 +180,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -231,7 +231,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -280,7 +280,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -325,7 +325,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -370,7 +370,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 4b8555c8f3e5..186e2ff94e8f 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
@@ -46,7 +46,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -94,7 +94,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -142,7 +142,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -190,7 +190,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -304,11 +304,15 @@ def _deploy_initial(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -560,11 +564,15 @@ def _save_initial(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
@@ -816,11 +824,15 @@ def _validate_initial(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
+ response_headers = {}
if response.status_code == 200:
deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, response_headers)
return deserialized
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 65907936adad..b3ecd1b79f73 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -88,7 +88,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 94cfe314af91..5f5c557091f9 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
@@ -46,7 +46,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 d94cfde7c8e9..27fb7d2158cd 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 35f377f13206..8004ad420d34 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
@@ -42,7 +42,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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 8cf5e6f59d50..522e63171c12 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
@@ -50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -98,7 +98,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -139,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -187,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -235,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -289,7 +289,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -337,7 +337,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -378,7 +378,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", "2022-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
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 081e68a54976..2e21b683ab62 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
@@ -50,7 +50,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +97,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", "2022-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
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..aca9434675a8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_export_operations.py
@@ -0,0 +1,197 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.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, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiExportResult or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiExportResult
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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("ApiExportResult", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
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..b70db20847e6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_operations.py
@@ -0,0 +1,1172 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_api.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("OperationCollection", pipeline_response)
+ 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)
+
+ list_by_api.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("OperationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("OperationContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("OperationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.OperationUpdateContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: OperationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.OperationContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("OperationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"
+ }
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..fdd1ea81b2d0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_policy_operations.py
@@ -0,0 +1,927 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_operation.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_operation.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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 = case_insensitive_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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"
+ }
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..e31951a10d54
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operations.py
@@ -0,0 +1,1212 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, TypeVar, Union, cast, 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.pipeline.transport import HttpResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.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, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ parameters: Union[_models.ApiCreateOrUpdateParameter, IO],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.ApiContract]:
+ error_map = {
+ 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[Optional[_models.ApiContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ deserialized = None
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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],
+ 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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdateParameter or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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
+ )
+ 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("ApiContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiUpdateContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"
+ }
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..782b02b0fcee
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_policy_operations.py
@@ -0,0 +1,874 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_api.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_api.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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 = case_insensitive_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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"
+ }
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..37e6d5bc8c5b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_release_operations.py
@@ -0,0 +1,1173 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiReleaseCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiReleaseContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiReleaseContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiReleaseContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiReleaseContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"
+ }
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..2208008b1608
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_revision_operations.py
@@ -0,0 +1,235 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiRevisionCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/revisions"
+ }
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..d68c44c334ca
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_schema_operations.py
@@ -0,0 +1,1001 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, TypeVar, Union, cast, 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.pipeline.transport import HttpResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.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, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_api.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("SchemaCollection", pipeline_response)
+ 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)
+
+ list_by_api.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SchemaContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SchemaContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
+
+ 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],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.SchemaContract]:
+ error_map = {
+ 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[Optional[_models.SchemaContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ deserialized = None
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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
+ )
+ 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("SchemaContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"
+ }
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..f052ba19ced0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_version_set_operations.py
@@ -0,0 +1,1103 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ApiVersionSetCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ApiVersionSetUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ApiVersionSetContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ApiVersionSetContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ApiVersionSetContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"
+ }
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..f8383aaad79b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_global_schema_operations.py
@@ -0,0 +1,944 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, TypeVar, Union, cast, 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.pipeline.transport import HttpResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.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, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("GlobalSchemaCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GlobalSchemaContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: Union[_models.GlobalSchemaContract, IO],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.GlobalSchemaContract]:
+ error_map = {
+ 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[Optional[_models.GlobalSchemaContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ deserialized = None
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either GlobalSchemaContract or the result of
+ cls(response)
+ :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ parameters: IO,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either GlobalSchemaContract or the result of
+ cls(response)
+ :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @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],
+ 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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either GlobalSchemaContract or the result of
+ cls(response)
+ :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_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
+ )
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ response_headers = {}
+ response = pipeline_response.http_response
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ return deserialized
+
+ if polling is True:
+ polling_method: 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"
+ }
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..9d2fee7d8972
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_group_operations.py
@@ -0,0 +1,1088 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("GroupCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GroupContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupCreateParameters or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GroupContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GroupContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GroupUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GroupContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GroupContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("GroupContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"
+ }
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..60be721378c9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_group_user_operations.py
@@ -0,0 +1,620 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("UserCollection", pipeline_response)
+ 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)
+
+ list.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.check_entity_exists.metadata["url"],
+ 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 [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, {})
+ return 200 <= response.status_code <= 299
+
+ check_entity_exists.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: UserContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.UserContract
+ :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.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,
+ template_url=self.create.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("UserContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("UserContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId}"
+ }
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..84fd3e4cc742
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_named_value_operations.py
@@ -0,0 +1,1622 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, TypeVar, Union, cast, 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.pipeline.transport import HttpResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.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, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("NamedValueCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: NamedValueContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NamedValueContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ 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],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.NamedValueContract]:
+ error_map = {
+ 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[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ deserialized = None
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueCreateContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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
+ )
+ 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)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ 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],
+ **kwargs: Any
+ ) -> Optional[_models.NamedValueContract]:
+ error_map = {
+ 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[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._update_initial.metadata["url"],
+ 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, 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)
+
+ 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"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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],
+ **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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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
+ )
+ 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)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: NamedValueSecretContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NamedValueSecretContract
+ :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.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,
+ template_url=self.list_value.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("NamedValueSecretContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ list_value.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/listValue"
+ }
+
+ def _refresh_secret_initial(
+ self, resource_group_name: str, service_name: str, workspace_id: str, named_value_id: str, **kwargs: Any
+ ) -> Optional[_models.NamedValueContract]:
+ 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[Optional[_models.NamedValueContract]] = 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,
+ template_url=self._refresh_secret_initial.metadata["url"],
+ 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, 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)
+
+ 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"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _refresh_secret_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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
+ )
+ 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)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_refresh_secret.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret"
+ }
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..a57c94a4e1dd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_operations.py
@@ -0,0 +1,486 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("NotificationCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: NotificationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NotificationContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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("NotificationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: NotificationContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.NotificationContract
+ :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.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,
+ template_url=self.create_or_update.metadata["url"],
+ 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("NotificationContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}"
+ }
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..ddbfac6a8b62
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_recipient_email_operations.py
@@ -0,0 +1,585 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.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, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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:
+ """
+ .. 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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: RecipientEmailCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailCollection
+ :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.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,
+ template_url=self.list_by_notification.metadata["url"],
+ 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("RecipientEmailCollection", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_by_notification.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.check_entity_exists.metadata["url"],
+ 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 [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, {})
+ return 200 <= response.status_code <= 299
+
+ check_entity_exists.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: RecipientEmailContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientEmailContract
+ :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.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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("RecipientEmailContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("RecipientEmailContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email}"
+ }
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..18119f0d3ef5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_notification_recipient_user_operations.py
@@ -0,0 +1,588 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.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, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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:
+ """
+ .. 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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: RecipientUserCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientUserCollection
+ :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.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,
+ template_url=self.list_by_notification.metadata["url"],
+ 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("RecipientUserCollection", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_by_notification.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.check_entity_exists.metadata["url"],
+ 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 [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, {})
+ return 200 <= response.status_code <= 299
+
+ check_entity_exists.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: RecipientUserContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.RecipientUserContract
+ :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.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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("RecipientUserContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("RecipientUserContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId}"
+ }
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..f47b5e46a3ec
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_operations.py
@@ -0,0 +1,1021 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("WorkspaceContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("WorkspaceContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("WorkspaceContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.WorkspaceContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: WorkspaceContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.WorkspaceContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("WorkspaceContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"
+ }
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..cd42e81205e5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_fragment_operations.py
@@ -0,0 +1,1098 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, TypeVar, Union, cast, 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.pipeline.transport import HttpResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.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, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyFragmentContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ parameters: Union[_models.PolicyFragmentContract, IO],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> Optional[_models.PolicyFragmentContract]:
+ error_map = {
+ 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[Optional[_models.PolicyFragmentContract]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IO, 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,
+ template_url=self._create_or_update_initial.metadata["url"],
+ 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, 201, 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)
+
+ 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)
+
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ _create_or_update_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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],
+ 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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyFragmentContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either 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
+ )
+ 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("PolicyFragmentContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+ 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.from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ begin_create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ResourceCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ResourceCollection
+ :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.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,
+ template_url=self.list_references.metadata["url"],
+ 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("ResourceCollection", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_references.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}/listReferences"
+ }
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..5a1a2ab65ecd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_operations.py
@@ -0,0 +1,833 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_api.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_api.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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 = case_insensitive_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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"
+ }
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..7734608b6ac7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_api_link_operations.py
@@ -0,0 +1,749 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductApiLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("ProductApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}"
+ }
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..c2578b985542
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_group_link_operations.py
@@ -0,0 +1,749 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductGroupLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductGroupLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("ProductGroupLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}"
+ }
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..d3e0f043e3f0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_operations.py
@@ -0,0 +1,1110 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("ProductCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.ProductUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: ProductContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.ProductContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("ProductContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"
+ }
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..45d17ba9c252
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_policy_operations.py
@@ -0,0 +1,845 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Optional, TypeVar, Union, overload
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpResponse
+from azure.core.rest import HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.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, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyCollection or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyCollection
+ :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,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ template_url=self.list_by_product.metadata["url"],
+ 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, {})
+
+ return deserialized
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyContract or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyContract or the result of cls(response)
+ :rtype: ~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 = case_insensitive_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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"
+ }
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..17ff402bfba0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_subscription_operations.py
@@ -0,0 +1,1522 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("SubscriptionCollection", pipeline_response)
+ 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)
+
+ list.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_tag.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_tag.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionCreateParameters or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.SubscriptionUpdateParameters or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SubscriptionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.regenerate_primary_key.metadata["url"],
+ 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 [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, {})
+
+ regenerate_primary_key.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regeneratePrimaryKey"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.regenerate_secondary_key.metadata["url"],
+ 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 [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, {})
+
+ regenerate_secondary_key.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regenerateSecondaryKey"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: SubscriptionKeysContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.SubscriptionKeysContract
+ :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.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,
+ template_url=self.list_secrets.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("SubscriptionKeysContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ list_secrets.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/listSecrets"
+ }
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..a219b938f31f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_api_link_operations.py
@@ -0,0 +1,748 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagApiLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagApiLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagApiLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagApiLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}"
+ }
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..e640356c3cf6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operation_link_operations.py
@@ -0,0 +1,749 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagOperationLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagOperationLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagOperationLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagOperationLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}"
+ }
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..2d1a716bc3b3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operations.py
@@ -0,0 +1,1085 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_service.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ request.url = self._client.format_url(request.url)
+ request.method = "GET"
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("TagCollection", pipeline_response)
+ 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)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: bool or the result of cls(response)
+ :rtype: bool
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.get_entity_state.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ if cls:
+ return cls(pipeline_response, None, response_headers)
+ return 200 <= response.status_code <= 299
+
+ get_entity_state.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ 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
+ :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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ 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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO
+ :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. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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 = {}
+ if response.status_code == 200:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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 type.
+ Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagCreateUpdateParameters or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.update.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"
+ }
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..357d84b0c3b7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_product_link_operations.py
@@ -0,0 +1,749 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# 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, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse
+from azure.core.rest import 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 .._serialization import Serializer
+from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+
+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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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", "2022-09-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", min_length=1),
+ }
+
+ _url: str = _format_url_section(_url, **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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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 = {
+ 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,
+ template_url=self.list_by_product.metadata["url"],
+ headers=_headers,
+ params=_params,
+ )
+ request = _convert_request(request)
+ 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 = _convert_request(request)
+ 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)
+
+ list_by_product.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :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.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,
+ template_url=self.get.metadata["url"],
+ 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)
+
+ response_headers = {}
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers)
+
+ return deserialized
+
+ get.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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,
+ *,
+ 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
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :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],
+ **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
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.TagProductLinkContract or IO
+ :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
+ Default value is None.
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: TagProductLinkContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.TagProductLinkContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map = {
+ 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, (IO, 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,
+ template_url=self.create_or_update.metadata["url"],
+ 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, 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)
+
+ if response.status_code == 200:
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if response.status_code == 201:
+ deserialized = self._deserialize("TagProductLinkContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ create_or_update.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}"
+ }
+
+ @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
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ 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[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,
+ template_url=self.delete.metadata["url"],
+ 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, 204]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ delete.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}"
+ }
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 9c0913a1103e..7492e40cba37 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
@@ -36,6 +36,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/2022-09-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 866e795c08a7..d2f8ac2e2763 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
@@ -46,6 +46,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/2022-09-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 7b386a31e04c..6b1d365d58ad 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
@@ -37,6 +37,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/2022-09-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 ab95404face8..621304477ee4 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
@@ -37,6 +37,6 @@ def main():
print(response)
-# 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/2022-09-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 afc0be2e5da1..ec5419a0b331 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
@@ -43,6 +43,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/2022-09-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 a9d692ddb896..e7d816c752fb 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
@@ -42,6 +42,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/2022-09-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 99c9e67c1398..32f965284c01 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
@@ -43,6 +43,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/2022-09-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 62a47f74bf61..976f9f4020a0 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
@@ -44,6 +44,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/2022-09-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 bdf19c72acb1..6487f27b8682 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
@@ -50,6 +50,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/2022-09-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 76cbe83e0822..e3055bf29703 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
@@ -49,6 +49,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/2022-09-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 e234f7f326c5..7e43e7ae20d4 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
@@ -53,6 +53,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/2022-09-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 47f9477689a2..8ffe83230dbe 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
@@ -47,6 +47,6 @@ def main():
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/2022-09-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 a902b10e2936..37ae507d7a4e 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
@@ -42,6 +42,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/2022-09-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 c29fb088ef95..4d1ef0ed8686 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
@@ -46,6 +46,6 @@ def main():
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/2022-09-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 2dbc979cb1be..2309cb158efc 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
@@ -51,6 +51,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/2022-09-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 997cf3d36e4e..48c698684a71 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
@@ -63,6 +63,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/2022-09-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 931d0c16dfd3..92c845c9115e 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
@@ -45,6 +45,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/2022-09-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 0eda2fe84ae4..317444ce252a 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
@@ -39,6 +39,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/2022-09-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 9d0a20ec2314..2c701d421385 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
@@ -44,6 +44,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/2022-09-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 8f2ee2123898..46bb78ce8f07 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
@@ -44,6 +44,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/2022-09-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 d333daf5e79f..99a29c4708ab 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
@@ -44,6 +44,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/2022-09-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 cff644c8763c..e166f8c2a0ef 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
@@ -45,6 +45,6 @@ def main():
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/2022-09-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 85b2e19c0f0d..862cdb1258a9 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
@@ -46,6 +46,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/2022-09-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 a201adaff8d9..742a72a521cb 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
@@ -38,6 +38,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/2022-09-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 5edab1228919..20bc8f5dd2b9 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
@@ -45,6 +45,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/2022-09-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 c8adaa0c8ddb..678834ec64eb 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
@@ -45,6 +45,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/2022-09-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 ca6dc2a47ba7..6eb676e3bd1b 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
@@ -44,6 +44,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/2022-09-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 b82c55216874..169d67373642 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
@@ -45,6 +45,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/2022-09-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 18432af91a9f..9113a4808ed5 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
@@ -44,6 +44,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/2022-09-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 660e4e0706ff..481a913375ea 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
@@ -44,6 +44,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/2022-09-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 5ebb16858411..2f845d4df90c 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
@@ -44,6 +44,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/2022-09-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 e1ac3e8d2fae..b34cabd43838 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
@@ -38,6 +38,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/2022-09-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 9a7e4f120062..ca5dae66891b 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
@@ -53,6 +53,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/2022-09-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 f547a8c80566..9f8f8a5cc1c2 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
@@ -59,6 +59,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/2022-09-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 d75125657e81..7e85fe5de01b 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
@@ -50,6 +50,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/2022-09-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 3e3f53355ebd..0439fa6f1566 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
@@ -39,6 +39,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/2022-09-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 d66d2bcdc3ff..4f0c0da310b3 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
@@ -48,6 +48,6 @@ def main():
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/2022-09-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 e5b27bba4dad..581ca0b07051 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
@@ -45,6 +45,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/2022-09-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 1c3d79a871dc..70f57b9bff91 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
@@ -54,6 +54,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/2022-09-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 dce23b211d17..d12ecabe2e68 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
@@ -52,6 +52,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/2022-09-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 136d0102929f..62b7bb5db2e1 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
@@ -56,6 +56,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/2022-09-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 3b1dd1398660..96229b9cd3eb 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
@@ -53,6 +53,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/2022-09-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 ced222c85d93..adc7d2ecf439 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
@@ -57,6 +57,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/2022-09-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 660b77831be2..790af3318435 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
@@ -51,6 +51,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/2022-09-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 286c9b981618..236e994dec58 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
@@ -54,6 +54,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/2022-09-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 19db318518b7..6c44b1b7cf0f 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
@@ -45,6 +45,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/2022-09-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 8beefccfeaa7..d2dd2585b7da 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
@@ -43,6 +43,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/2022-09-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 c38592b14d5d..c3faea8b5137 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
@@ -45,6 +45,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/2022-09-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 2a3fd6513f84..4ef87b1d6883 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
@@ -85,6 +85,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/2022-09-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 c008a5299155..204d891f88bd 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
@@ -49,6 +49,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/2022-09-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 e7128a76d6e2..3f456117a896 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
@@ -52,6 +52,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/2022-09-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 97e997000344..52e03ac662ba 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
@@ -38,6 +38,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/2022-09-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 9f184e8d9d1e..433ab5da4548 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
@@ -47,6 +47,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/2022-09-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 8987d294fe1d..bb142f0318e5 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
@@ -38,6 +38,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/2022-09-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 457ef7bdfd78..d7aa3428b5c4 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
@@ -38,6 +38,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/2022-09-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 1bfbb71590e2..c7f97243219c 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
@@ -39,6 +39,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/2022-09-01-preview/examples/ApiManagementCreateGatewayCertificateAuthority.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 cd1ca1f5b6d7..fe3e5fd4808b 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
@@ -48,6 +48,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/2022-09-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 43159c660445..868cd462c37e 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
@@ -44,6 +44,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/2022-09-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 786cff0e0fa1..87c9d3a6706b 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
@@ -58,6 +58,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/2022-09-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 51de15eec866..3d7e92d8cb26 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
@@ -47,6 +47,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/2022-09-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 d51ecce90217..f016ac58ebb2 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
@@ -45,6 +45,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/2022-09-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 a6a795b7b651..3901da4cadad 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
@@ -45,6 +45,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/2022-09-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 ac42dffb2fe2..89b0dc6c14fc 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
@@ -38,6 +38,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/2022-09-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 fc49963ea614..87c6d7fcf92e 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
@@ -45,6 +45,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/2022-09-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 e9836afd9d86..fccd7e1a9290 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
@@ -38,6 +38,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/2022-09-01-preview/examples/ApiManagementCreateGroupUser.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 f11cfccf08ba..18865a3c76c5 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
@@ -38,6 +38,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/2022-09-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 3a8d75aeb984..af9927ff63a2 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
@@ -71,6 +71,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/2022-09-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 86be1b09b56c..69b25fdf44ff 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
@@ -40,6 +40,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/2022-09-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 646381950ec7..3b94f2077706 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
@@ -48,6 +48,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/2022-09-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 a008810a2a79..433bb563443a 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
@@ -37,6 +37,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/2022-09-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 4a508ff99f3b..4f30d7d19f55 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
@@ -38,6 +38,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/2022-09-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 49bddde3336b..699043f63ec4 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
@@ -38,6 +38,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/2022-09-01-preview/examples/ApiManagementCreateNotificationRecipientUser.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 792c44aa500a..ab0837f0cf4c 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
@@ -47,6 +47,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/2022-09-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 94da1ee882af..9b4c24c8f5cb 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
@@ -43,6 +43,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/2022-09-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 7965fa178968..55a1dcc14e32 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
@@ -44,6 +44,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/2022-09-01-preview/examples/ApiManagementCreatePolicyFragment.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 4476b4d39569..4eeb4148d680 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
@@ -59,6 +59,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/2022-09-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 b14099fad1ae..73e310fb6d9b 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
@@ -38,6 +38,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/2022-09-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 a6b677242960..c77e2b02e86d 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
@@ -38,6 +38,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/2022-09-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 f74f7f05782a..ab4c4248c5e1 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
@@ -38,6 +38,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/2022-09-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..73044a93e841
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_api_link.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_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="subid",
+ )
+
+ 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/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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 fc2148c1c51a..06d29c486b42 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
@@ -38,6 +38,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/2022-09-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..5234947efb9b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_product_group_link.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_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="subid",
+ )
+
+ 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/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/group1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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 0ea8bce9f0d3..30c59b32f27d 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
@@ -44,6 +44,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/2022-09-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 21f5a33a3423..2094e08d3989 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
@@ -38,6 +38,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/2022-09-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 ac7b22aee0a2..2608f17ebbcc 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
@@ -38,6 +38,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/2022-09-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 ecc5415b0cc9..29308687eaff 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
@@ -42,6 +42,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/2022-09-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 3bebe1bc1c33..ed3bca909c87 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
@@ -43,6 +43,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/2022-09-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 7b820ec214f3..e25dbdab6afc 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
@@ -51,6 +51,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/2022-09-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 e81ad0f01ca3..8a41d6a2d3a9 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
@@ -43,6 +43,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/2022-09-01-preview/examples/ApiManagementCreateServiceInZones.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 581cc7c4ff4b..de6af52a8d72 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
@@ -74,6 +74,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/2022-09-01-preview/examples/ApiManagementCreateServiceWithCustomHostnameKeyVault.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 63ff3831197f..f2bbd8c1a109 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
@@ -46,6 +46,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/2022-09-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 fada765fab3c..3cf7d4008459 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
@@ -52,6 +52,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/2022-09-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 a3ee4ded4bce..189b15af1160 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
@@ -48,6 +48,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/2022-09-01-preview/examples/ApiManagementCreateServiceWithUserAssignedIdentity.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 311ded97a5d8..a20b87eaf92c 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
@@ -46,6 +46,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/2022-09-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 031b56325ab1..ae13f20c1261 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
@@ -45,6 +45,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/2022-09-01-preview/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.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 e1673a588051..748c0404a0f0 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
@@ -44,6 +44,6 @@ def main():
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/2022-09-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 0b30647817aa..b54b13372eab 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
@@ -38,6 +38,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/2022-09-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..81b35c2876a0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_api_link.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_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="subid",
+ )
+
+ 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/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..d22b5378cfa7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_operation_link.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_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="subid",
+ )
+
+ 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/subid/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/2022-09-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..3ab991ae732c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_tag_product_link.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_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="subid",
+ )
+
+ 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/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/product1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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 5aaea8ba209e..8e49d287db91 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
@@ -38,6 +38,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/2022-09-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 3686be972670..f5670deb29b8 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
@@ -39,6 +39,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/2022-09-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 b23a44fbb6a2..e016be80127a 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
@@ -45,6 +45,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/2022-09-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 f32fc0d62cae..f35086d450bc 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
@@ -47,6 +47,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/2022-09-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..ac01f67f0042
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementCreateWorkspace.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..25ea4fef8e16
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api.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.
+# --------------------------------------------------------------------------
+
+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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementCreateWorkspaceApi.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..11d9916a3a9f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_operation.py
@@ -0,0 +1,69 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license 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="subid",
+ )
+
+ 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/2022-09-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..cd0299b4c9e0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_operation_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_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="subid",
+ )
+
+ 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/2022-09-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..6ebcab097829
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_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_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="subid",
+ )
+
+ 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/2022-09-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..239915811266
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_release.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_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="subid",
+ )
+
+ 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/subid/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/2022-09-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..8b590f1650a3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_schema.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_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="subid",
+ )
+
+ 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/2022-09-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..7b931caee976
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_api_version_set.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementCreateWorkspaceApiVersionSet.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..f6b42d3e6c57
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_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_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="subid",
+ )
+
+ 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/2022-09-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..71479edbffaf
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_group_external.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_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="subid",
+ )
+
+ 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/2022-09-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..83359ad66360
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_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_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="subid",
+ )
+
+ 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/2022-09-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..194b99f24f4b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_named_value.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_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="subid",
+ )
+
+ 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/2022-09-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..0fbd9f9fa6f6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_named_value_with_key_vault.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_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="subid",
+ )
+
+ 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/2022-09-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..f94b55343e36
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_notification.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_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="subid",
+ )
+
+ 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/2022-09-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..48586e0b46a3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_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_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="subid",
+ )
+
+ 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/2022-09-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..785b385a4f4a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_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_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="subid",
+ )
+
+ 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/2022-09-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..7aaf4c72098a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy.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_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="subid",
+ )
+
+ 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/2022-09-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..c44716ee2411
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy_fragment.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_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="subid",
+ )
+
+ 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/2022-09-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..216aedb49293
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_policy_non_xml_encoded.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementCreateWorkspacePolicyNonXmlEncoded.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..c6e619fa96d7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_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_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="subid",
+ )
+
+ 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/2022-09-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..a74ecc7a84c2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_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_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="subid",
+ )
+
+ 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/subid/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/2022-09-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..9d8cc3488f9d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_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_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="subid",
+ )
+
+ 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/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/groups/group1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..fe7c44bdab4f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_product_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_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="subid",
+ )
+
+ 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/2022-09-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..24916988f3a6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_schema.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_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="subid",
+ )
+
+ 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/2022-09-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..71ed122436df
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_subscription.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_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="subid",
+ )
+
+ 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/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7",
+ "scope": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/products/5600b59475ff190048060002",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..8b8079942e26
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_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_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="subid",
+ )
+
+ 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/2022-09-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..c6f66aef4a89
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_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_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="subid",
+ )
+
+ 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/subid/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/2022-09-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..47559b4dd63f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_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_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="subid",
+ )
+
+ 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/subid/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/2022-09-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..efb78ef7c86f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_workspace_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_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="subid",
+ )
+
+ 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/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/products/product1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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 9be10ce50609..8195a60edbcd 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 6b9119c4bc2a..0f60217c1336 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 1320cea1195d..a10cb0ab27c1 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 6ddcee0dcc09..f890f79e61de 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
@@ -40,6 +40,6 @@ def main():
print(response)
-# 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/2022-09-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 41d86b3ac75c..e0038b1bfae8 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
@@ -40,6 +40,6 @@ def main():
print(response)
-# 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/2022-09-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 30ca907557ce..8d4efa3ca16c 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 eafb3619907c..926fc6dc8fc7 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
@@ -40,6 +40,6 @@ def main():
print(response)
-# 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/2022-09-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 908ce449b927..9d1c82de787f 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 388004a9e0c0..1e3f5928103f 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 a4eac7ee0db3..29715a6c4b16 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 4351c5294187..c7362ba83892 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 72ebe4b5b87b..a0ea692ffccd 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 7806815ae385..b0ccd37bf7a9 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 0e111d9e13bc..28016f0190af 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 78358be3727f..51ddcf4df4d0 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 fda86e21e9e5..94fd40909147 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 65e91a879e6a..327a8ce355c0 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
@@ -40,6 +40,6 @@ def main():
print(response)
-# 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/2022-09-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 f464346a31bf..4494a584ee2e 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 19ed49dee3e1..6300a5ecb946 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 b35075299406..47cfa551892e 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 b2f812b814c1..7484a2393cfe 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 064937131620..4f1978a077cc 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 8d5611b867aa..5fe69b737bb5 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 e399366dc69d..e46f8edfa407 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 fa47b92426c2..d38bfebbf1a7 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 ce562fe0bb28..b726ecc34014 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 b3c82688efec..f801552f0684 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 1f9bce046cee..b3ed15d44b0f 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-01-preview/examples/ApiManagementDeleteGatewayCertificateAuthority.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 c535670c1dd0..31bcf60ee447 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 29d385eee68d..f735bed3456c 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 247cb77ab2b7..c00237c8eb35 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 269ffc60fff2..52e88837999d 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
@@ -40,6 +40,6 @@ def main():
print(response)
-# 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/2022-09-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 3baf4e23dba9..9b76bb86c64a 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 5a4fd00e38d6..b721129252d1 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 f13a68c26c46..46d3bc464a87 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 0a9d5fa23502..7846e23999d1 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 6ef310657d43..65b62fa0b645 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 bbaa6786d006..e402bc035dc5 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 736f9c1b46c7..7e610e5e0d61 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 6ddd1926e565..8604c262d031 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 9404ab237483..a33b6148e97b 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 175224fc32cc..f98da6f5b2d2 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-01-preview/examples/ApiManagementDeletePolicyFragment.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 657cd5cc11da..ffecce24aad3 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
@@ -37,6 +37,6 @@ def main():
print(response)
-# 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/2022-09-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 bcfd154ca128..a2b47b8c05da 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 6184b23a4d22..491d9f49bf40 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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..f95bffc47889
--- /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="subid",
+ )
+
+ response = client.product_api_link.delete(
+ 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/2022-09-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 88d23dd04e70..3e1319bd0462 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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..366f51281fb5
--- /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="subid",
+ )
+
+ response = client.product_group_link.delete(
+ 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/2022-09-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 7d59fe657c96..ad1059871376 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 794355eb6152..8c5bba49430f 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 362c57e670ba..c9265aaa2428 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 1b6378e9d831..a88899e29644 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 4fc160714b00..89e96d681c79 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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..2d4db30265f4
--- /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="subid",
+ )
+
+ response = client.tag_api_link.delete(
+ 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/2022-09-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..ea45167d2e1f
--- /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="subid",
+ )
+
+ response = client.tag_operation_link.delete(
+ 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/2022-09-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..7f78ae5525c6
--- /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="subid",
+ )
+
+ response = client.tag_product_link.delete(
+ 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/2022-09-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 3a6973e2e7db..24eae5799584 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 ad0b212e3e9c..106fc9e85114 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-01-preview/examples/ApiManagementDeleteUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace.py
new file mode 100644
index 000000000000..22a55b91dc2d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_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,
+ 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",
+ )
+
+ response = client.workspace.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..ec010dfe15fd
--- /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="subid",
+ )
+
+ response = client.workspace_api.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteWorkspaceApi.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..7efb8621985a
--- /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="subid",
+ )
+
+ response = client.workspace_api_operation.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ operation_id="57d2ef278aa04f0ad01d6cdc",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..9d7ae8b2c03e
--- /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="subid",
+ )
+
+ response = 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="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..0a3c94b9c250
--- /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="subid",
+ )
+
+ response = client.workspace_api_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="loggerId",
+ policy_id="policy",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..e97ce12a3705
--- /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="subid",
+ )
+
+ response = client.workspace_api_release.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5a5fcc09124a7fa9b89f2f1d",
+ release_id="testrev",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..26eb1372fd6e
--- /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="subid",
+ )
+
+ response = client.workspace_api_schema.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="59d5b28d1f7fab116c282650",
+ schema_id="59d5b28e1f7fab116402044e",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..4fbc82b32ea8
--- /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="subid",
+ )
+
+ response = client.workspace_api_version_set.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="a1",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteWorkspaceApiVersionSet.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..4a3ea8b0e148
--- /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="subid",
+ )
+
+ response = client.workspace_group.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="aadGroup",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..a23b1362ef70
--- /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="subid",
+ )
+
+ response = client.workspace_group_user.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="templategroup",
+ user_id="59307d350af58404d8a26300",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementDeleteWorkspaceGroupUser.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..d5ca182563fe
--- /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="subid",
+ )
+
+ response = client.workspace_named_value.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop2",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..a4c0bdb219c5
--- /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="subid",
+ )
+
+ response = client.workspace_notification_recipient_email.delete(
+ 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/2022-09-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..aeb666cd12dc
--- /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="subid",
+ )
+
+ response = client.workspace_notification_recipient_user.delete(
+ 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/2022-09-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..0c4d323143ef
--- /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="subid",
+ )
+
+ response = client.workspace_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..2917d9dba644
--- /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="subid",
+ )
+
+ response = client.workspace_policy_fragment.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..1ae83e34919f
--- /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="subid",
+ )
+
+ response = client.workspace_product.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..60f54c0939a2
--- /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="subid",
+ )
+
+ response = client.workspace_product_api_link.delete(
+ 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/2022-09-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..aaa7bd40c8a5
--- /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="subid",
+ )
+
+ response = client.workspace_product_group_link.delete(
+ 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/2022-09-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..0303aaadd39d
--- /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="subid",
+ )
+
+ response = client.workspace_product_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ policy_id="policy",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..3fadc4d69992
--- /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="subid",
+ )
+
+ response = client.workspace_global_schema.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ schema_id="schema1",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..c76fbd4b8bd8
--- /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="subid",
+ )
+
+ response = client.workspace_subscription.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..e4bd9a3c934c
--- /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="subid",
+ )
+
+ response = client.workspace_tag.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tagId1",
+ if_match="*",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..d7a03bd0eb41
--- /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="subid",
+ )
+
+ response = client.workspace_tag_api_link.delete(
+ 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/2022-09-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..c60d387d91dc
--- /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="subid",
+ )
+
+ response = client.workspace_tag_operation_link.delete(
+ 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/2022-09-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..1b2fe2ae60a3
--- /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="subid",
+ )
+
+ response = client.workspace_tag_product_link.delete(
+ 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/2022-09-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 1afa288dbba0..0252d5c2497f 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
@@ -34,6 +34,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/2022-09-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 8733ac654d62..afa2f18c02f5 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
@@ -36,6 +36,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/2022-09-01-preview/examples/ApiManagementDeletedServicesPurge.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 fd749bc415dd..3834bee44783 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
@@ -38,6 +38,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/2022-09-01-preview/examples/ApiManagementGatewayGenerateToken.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 b79cc17505ee..a5abaf63fe1f 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
@@ -37,6 +37,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/2022-09-01-preview/examples/ApiManagementGatewayListKeys.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 3fdbe8cdf7b9..fcd845ff2d0f 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 e25e5f5b8c67..0aec0c9958e6 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
@@ -37,6 +37,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/2022-09-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 ee0e3329be7f..6d8771a12091 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
@@ -38,6 +38,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/2022-09-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 1b5c86209b6f..9e9edca9be55 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
@@ -39,6 +39,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/2022-09-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 394a01f559e5..e93e34e98b80 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
@@ -39,6 +39,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/2022-09-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 b9a83da56cba..1bae4b31ab5c 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
@@ -38,6 +38,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/2022-09-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 d66b6211b9d3..4de27d64ff10 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
@@ -39,6 +39,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/2022-09-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 4d9ee8faf668..ddaa0b49b830 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
@@ -39,6 +39,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/2022-09-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 e31e44c23124..d621d7d83c3e 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
@@ -38,6 +38,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/2022-09-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 885eacace5ea..c97ff76f6a84 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
@@ -38,6 +38,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/2022-09-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 420418157b38..7ce884e98f80 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
@@ -39,6 +39,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/2022-09-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 0f94b8f7babf..db722f0b606a 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
@@ -39,6 +39,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/2022-09-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 3790995d5f75..ba0b1345fe03 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
@@ -38,6 +38,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/2022-09-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 ccb1abf680ee..9b6cf670932d 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
@@ -38,6 +38,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/2022-09-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 e6c70b6a1ded..cde9fa056444 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
@@ -37,6 +37,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/2022-09-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 69f23588adce..4bf22cc71424 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
@@ -38,6 +38,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/2022-09-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 fe612a39de9f..79bb7e768a95 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
@@ -38,6 +38,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/2022-09-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 9968fe99f2d7..97162201e842 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
@@ -38,6 +38,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/2022-09-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 a5c52589869d..06dbddfa719f 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
@@ -37,6 +37,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/2022-09-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 a9e58a851c2f..3dc269e76bef 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
@@ -37,6 +37,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/2022-09-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 9938fbe489b6..e4641d8373eb 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
@@ -38,6 +38,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/2022-09-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 889bd6c66525..ae50b417cec6 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
@@ -39,6 +39,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/2022-09-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 91a8679592a0..570568c10f8f 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
@@ -39,6 +39,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/2022-09-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 d2a635cd9367..4d05ac46e0bb 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
@@ -37,6 +37,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/2022-09-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 cdb52249df96..49ab0a9050e0 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
@@ -37,6 +37,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/2022-09-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 02055b15dd11..c12da60b55ea 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
@@ -37,6 +37,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/2022-09-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 a92a816552a7..1885fe32e6dc 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
@@ -37,6 +37,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/2022-09-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 700e33b78d70..41d7cd77e029 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
@@ -37,6 +37,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/2022-09-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 389f010be603..c9782389772a 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
@@ -37,6 +37,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/2022-09-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 c7f84ae2f14a..3f173d40c52a 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
@@ -37,6 +37,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/2022-09-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 ad7aeb998437..7e6393165c23 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
@@ -38,6 +38,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/2022-09-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 9386293b9261..8221dfa63d66 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
@@ -36,6 +36,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/2022-09-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 6a68e671fa7d..0608a6457a9c 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
@@ -37,6 +37,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/2022-09-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 0fc66abe3c3d..b2fccdd2f3ae 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
@@ -37,6 +37,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/2022-09-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 67a57f377667..db6a88da1d7e 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
@@ -37,6 +37,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/2022-09-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 1fc4568d34e4..42f4375dcf6b 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
@@ -38,6 +38,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/2022-09-01-preview/examples/ApiManagementGetGatewayCertificateAuthority.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 027d3acf1944..cb084f9dcc65 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
@@ -38,6 +38,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/2022-09-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 40d620878fb0..5814a6ad14e7 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
@@ -37,6 +37,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/2022-09-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 a3ac221911f4..3dfc83f74421 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
@@ -37,6 +37,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/2022-09-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 ef827021ec25..9811cf243f26 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
@@ -38,6 +38,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/2022-09-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 7c1cf4ce63a4..4dc92cc822a1 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
@@ -39,6 +39,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/2022-09-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 6ee0505371c5..0cf47c39fbf8 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
@@ -37,6 +37,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/2022-09-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 3b5c84ee7b0f..9e6d7f515088 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
@@ -37,6 +37,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/2022-09-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 16a3c0c19d91..65fd5abc0669 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
@@ -37,6 +37,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/2022-09-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 5627e38da3de..51add25e572d 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
@@ -37,6 +37,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/2022-09-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 6c92ec253e56..696aeef2cdf5 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
@@ -37,6 +37,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/2022-09-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 b4d73eae42a5..21cb48ba3f38 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
@@ -37,6 +37,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/2022-09-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 b1bd321e778c..dc8b64805d9a 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
@@ -37,6 +37,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/2022-09-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 d3b1fe5bac7a..ede618770ab4 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
@@ -37,6 +37,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/2022-09-01-preview/examples/ApiManagementGetOpenIdConnectProvider.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 61a9f87a0c59..9eb427e8d8d1 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
@@ -37,6 +37,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/2022-09-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 06992cffd8f9..15df236ae6de 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
@@ -37,6 +37,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/2022-09-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 b1dbfa25095d..591f96bb2a50 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
@@ -37,6 +37,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/2022-09-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 a83da3f0b53e..920bd712f0db 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
@@ -37,6 +37,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/2022-09-01-preview/examples/ApiManagementGetPolicyFragmentFormat.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 ca15c2610f31..da172cf56f5f 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
@@ -37,6 +37,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/2022-09-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 c15b7e16d1b4..7a3b800dfc99 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
@@ -37,6 +37,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/2022-09-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 b68af6008f97..d13e4c965859 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
@@ -37,6 +37,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/2022-09-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 fd7ccc52f9d1..8b95ba53c124 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
@@ -37,6 +37,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/2022-09-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..5cd47f719b7b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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..8fec339bf0e8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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 4a4ceb3bbb7b..f37186ad9d6e 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
@@ -38,6 +38,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/2022-09-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 8e57d00a14b6..bdd2d8f1b96b 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
@@ -38,6 +38,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/2022-09-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 8a5765a19842..3d97684ead5b 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
@@ -37,6 +37,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/2022-09-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 aafc467b3547..a22dfe82251d 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
@@ -37,6 +37,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/2022-09-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 325aaae9f834..2401d07f8619 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
@@ -38,6 +38,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/2022-09-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
index 901172a34a39..4d333d88d906 100644
--- 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
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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
index 40167add3648..6e99dd5e4020 100644
--- 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
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByGeo.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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
index a98babd79de4..7e545b6425f5 100644
--- 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
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByOperation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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
index 3c5db9edee1c..6c6c8799d815 100644
--- 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
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByProduct.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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
index 3f66b9b7c6f5..59e07bb85d2c 100644
--- 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
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByRequest.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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
index 5f041ecd09f9..953b9a577edf 100644
--- 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
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsBySubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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
index 265f9205ce74..24c95e6af551 100644
--- 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
@@ -41,6 +41,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByTime.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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
index 72a9f8525676..731d45465e71 100644
--- 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
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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 9c7333f36351..bc72913cd6d4 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
@@ -37,6 +37,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/2022-09-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 2024e3638c58..1ea33cec4f90 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
@@ -37,6 +37,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/2022-09-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..c353643262ad
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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..dd4cc1fc4a2e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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..49fbbfbdec69
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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 20d4484f9d90..84483fc06051 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
@@ -37,6 +37,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/2022-09-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 086a3df90aef..7eba7a18ee7d 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
@@ -37,6 +37,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/2022-09-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 8e66129ddcdd..5746548833e5 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
@@ -37,6 +37,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/2022-09-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 29efeea62c6c..385ea805196f 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
@@ -37,6 +37,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/2022-09-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 eb04bd44a98e..2b21aa26e8e1 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
@@ -37,6 +37,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/2022-09-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 d0c7acfc7ef2..b95d3681120d 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
@@ -38,6 +38,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/2022-09-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..e2ee57ac6178
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace.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_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="subid",
+ )
+
+ 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/2022-09-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..f9aada83c45b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_contract.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementGetWorkspaceApiContract.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..bd8b7a7ad54f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_export_in_open_api2dot0.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_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="subid",
+ )
+
+ 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/2022-09-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..121a85895c04
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_export_in_open_api3dot0.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_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="subid",
+ )
+
+ 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/2022-09-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..09a37727d720
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_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_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="subid",
+ )
+
+ 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/2022-09-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..1f3a7c5a8010
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_operation_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_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="subid",
+ )
+
+ 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/2022-09-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..5e9f7a43c57f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_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_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="subid",
+ )
+
+ 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/2022-09-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..72868baa6be8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_release.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_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="subid",
+ )
+
+ 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/2022-09-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..deb6a240fe4d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_revision.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_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="subid",
+ )
+
+ 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/2022-09-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..201ed5e5e153
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_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_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="subid",
+ )
+
+ 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/2022-09-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..ba2651322b85
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_api_version_set.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementGetWorkspaceApiVersionSet.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..8a8b2e6215e5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_group.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementGetWorkspaceGroup.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..4a29068b8a51
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_named_value.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_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="subid",
+ )
+
+ 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/2022-09-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..9a45af400be3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_named_value_with_key_vault.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_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="subid",
+ )
+
+ 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/2022-09-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..61ede9002e81
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_notification.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_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="subid",
+ )
+
+ 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/2022-09-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..f73138561053
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy.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_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="subid",
+ )
+
+ 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/2022-09-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..6de22116bcb8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy_fragment.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_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="subid",
+ )
+
+ 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/2022-09-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..569274fdad45
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_policy_fragment_format.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_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="subid",
+ )
+
+ 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/2022-09-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..a3fd8859014b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product.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_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="subid",
+ )
+
+ 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/2022-09-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..7d6a577b451f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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..fd3089519af9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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..e30baa18e2aa
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_product_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_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="subid",
+ )
+
+ 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/2022-09-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..e4a0d1a04674
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_schema.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_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="subid",
+ )
+
+ 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/2022-09-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..98080b25e9a6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_subscription.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_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="subid",
+ )
+
+ 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/2022-09-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..5ecbcf6ae75c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_workspace_tag.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_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="subid",
+ )
+
+ 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/2022-09-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..c8afbbce44a7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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..5bcbb79ddef0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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..97ef288937f5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_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_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="subid",
+ )
+
+ 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/2022-09-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 c3e21976fff6..a6eb493b5bcc 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
@@ -37,6 +37,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/2022-09-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 f6853a879692..b5b72cc0cbfa 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
@@ -38,6 +38,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/2022-09-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 b09689dce42f..bc3b594032d8 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
@@ -38,6 +38,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/2022-09-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 96dadb477371..ffc39fe1354a 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
@@ -39,6 +39,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/2022-09-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 1aaf883f4cae..9d13374b723b 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
@@ -39,6 +39,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/2022-09-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 8de3881349a5..b2ca1d1c4fbb 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
@@ -38,6 +38,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/2022-09-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 ba35eea190d0..01f14026a1ee 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
@@ -39,6 +39,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/2022-09-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 fdb59e274979..39a1deda39ca 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
@@ -39,6 +39,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/2022-09-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 5b341c9e558f..70cb9edd6f34 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
@@ -38,6 +38,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/2022-09-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 7a295bbb287e..bbdbfab1a2ab 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
@@ -38,6 +38,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/2022-09-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 e65d902f7809..1cacaeda989f 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
@@ -38,6 +38,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/2022-09-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 51882e1cee82..f1c5c987e8c3 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
@@ -38,6 +38,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/2022-09-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 54a154533db1..31a6ea3b6a81 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
@@ -38,6 +38,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/2022-09-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 bab6a3917883..bcfe38879ec4 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
@@ -37,6 +37,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/2022-09-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 491b0bcd8964..4c064b5ca528 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
@@ -37,6 +37,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/2022-09-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 b1809292f3f6..6d427154e185 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
@@ -37,6 +37,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/2022-09-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 0cb33535c357..a4c03083e792 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
@@ -37,6 +37,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/2022-09-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 d25da5d41ead..029f915ff086 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
@@ -37,6 +37,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/2022-09-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 c2f961530bbb..a4d3a6ce581f 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
@@ -37,6 +37,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/2022-09-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 28511033a9f0..23d9cdedf336 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
@@ -38,6 +38,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/2022-09-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 20fa54441574..86f71351a33b 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
@@ -36,6 +36,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/2022-09-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 f50f609a11c8..17fa99af125a 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
@@ -37,6 +37,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/2022-09-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 2d3e2d56b1f7..eca9b497b347 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
@@ -37,6 +37,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/2022-09-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 683406ab8542..4b2d58c01c14 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
@@ -37,6 +37,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/2022-09-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 e8c73a200e73..d591bcd45f98 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
@@ -37,6 +37,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/2022-09-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 92eee59fa5bf..54f7faeae27c 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
@@ -38,6 +38,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/2022-09-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 5dfd6d48d76c..2f601a035791 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
@@ -38,6 +38,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/2022-09-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 3c5cefacfd4a..3d22cd3ec587 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
@@ -38,6 +38,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/2022-09-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 df221d7b2559..7e32e700d067 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
@@ -37,6 +37,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/2022-09-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 d017f86adca6..49591ad137a2 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
@@ -38,6 +38,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/2022-09-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 68a48b00da7c..504cc8fc1579 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
@@ -39,6 +39,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/2022-09-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 507d1a2eff3f..65d3e9b144d2 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
@@ -37,6 +37,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/2022-09-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 fe1f24b1abfe..c814ef9b4db7 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
@@ -38,6 +38,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/2022-09-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 43167728061a..2b3ceb69512c 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
@@ -37,6 +37,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/2022-09-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 6c9520e0ee15..8b0a3e1d9fe8 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
@@ -37,6 +37,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/2022-09-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 4845de1461f6..de235a45bdc0 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
@@ -37,6 +37,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/2022-09-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 436e526ae98d..46ba18388625 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
@@ -38,6 +38,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/2022-09-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 61ec1ff34059..d7b6d95ccff5 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
@@ -38,6 +38,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/2022-09-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 6a2f9aca60e7..4ab7c9cdaf35 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
@@ -37,6 +37,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/2022-09-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 f3bc93e3057d..46e994031a58 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
@@ -37,6 +37,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/2022-09-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 98965d38f1ed..f044eab22483 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
@@ -37,6 +37,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/2022-09-01-preview/examples/ApiManagementHeadPolicyFragment.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 374abe53354c..22f266aeb309 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
@@ -37,6 +37,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/2022-09-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 5989b13a4cac..1add765e0448 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
@@ -37,6 +37,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/2022-09-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 051e6364f329..872160633bbc 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
@@ -37,6 +37,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/2022-09-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 3f2ec26f474a..4bfe412bd0b4 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
@@ -38,6 +38,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/2022-09-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 2ecd925a3493..b234291a5333 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
@@ -38,6 +38,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/2022-09-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 995fbb685c35..c1823606b7b1 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
@@ -38,6 +38,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/2022-09-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 e16c4e1fa672..0e8c233f07e9 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
@@ -38,6 +38,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/2022-09-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 7ff34f879393..e4c77a95c885 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
@@ -37,6 +37,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/2022-09-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 4b26a849e37c..83f963cebac7 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
@@ -36,6 +36,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/2022-09-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 63e62f56645d..a59804c78f4b 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
@@ -36,6 +36,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/2022-09-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 e7055ec652e9..38dfd2134219 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
@@ -37,6 +37,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/2022-09-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 9c4f84bfadc7..6ef7f674a7bd 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
@@ -37,6 +37,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/2022-09-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 1ce265cb23a0..617348425551 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
@@ -37,6 +37,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/2022-09-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 30b36bd733aa..4c9bba0fc001 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
@@ -37,6 +37,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/2022-09-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..1487836714cf
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace.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_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="subid",
+ )
+
+ 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/2022-09-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..be442a550d79
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementHeadWorkspaceApi.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..92e63d0f9676
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_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_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="subid",
+ )
+
+ 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/2022-09-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..7e8cc920484a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_operation_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_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="subid",
+ )
+
+ 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/2022-09-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..cf950d7c3c85
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_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_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="subid",
+ )
+
+ 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/2022-09-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..bfc1bcc1e430
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_release.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_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="subid",
+ )
+
+ 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/2022-09-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..929963f973ba
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_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_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="subid",
+ )
+
+ 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/2022-09-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..08b4c58a21bd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_api_version_set.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementHeadWorkspaceApiVersionSet.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..87627a844e4d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_group.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_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="subid",
+ )
+
+ 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/2022-09-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..1360d6a2a536
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementHeadWorkspaceGroupUser.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..3a2b56e567d1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_named_value.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_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="subid",
+ )
+
+ 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/2022-09-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..39f9b898f5e3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_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_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="subid",
+ )
+
+ 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/2022-09-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..3cc57035759e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_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_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="subid",
+ )
+
+ 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/2022-09-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..86255a6db39b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_policy.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_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="subid",
+ )
+
+ 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/2022-09-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..f1a4f07c2262
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_policy_fragment.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_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="subid",
+ )
+
+ 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/2022-09-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..6d81d919a422
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_product.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_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="subid",
+ )
+
+ 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/2022-09-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..0915ffe1f0d1
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_product_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_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="subid",
+ )
+
+ 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/2022-09-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..5425e6c45536
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_schema.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_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="subid",
+ )
+
+ 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/2022-09-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..5d92119d79fc
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_subscription.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_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="subid",
+ )
+
+ 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/2022-09-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..a0a4261ea2b7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_tag.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_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="subid",
+ )
+
+ 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/2022-09-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 e90e23a822b9..25f791501d33 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
@@ -37,6 +37,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/2022-09-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 e9233dc28006..f5907d3b016a 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
@@ -38,6 +38,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/2022-09-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 5c22ade28157..2a557e2855eb 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
@@ -39,6 +39,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/2022-09-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 010d320189d1..79d12dfc6db2 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
@@ -39,6 +39,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/2022-09-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 27450f00decd..def66e70ceeb 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
@@ -38,6 +38,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/2022-09-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 935631678d41..4f1a57ffb845 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
@@ -38,6 +38,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/2022-09-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 fb3eb97062e9..731861589f24 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
@@ -39,6 +39,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/2022-09-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 92a727154304..afca49cabf76 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
@@ -38,6 +38,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/2022-09-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 bd91a2e56d6a..8c44e8afeed0 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
@@ -38,6 +38,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/2022-09-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 106dbc9e10f7..1e104626ac2d 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
@@ -37,6 +37,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/2022-09-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 1a9f3ce93f95..909e7aa8bb1e 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
@@ -38,6 +38,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/2022-09-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 f3b7e604d000..6853f138b37c 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
@@ -38,6 +38,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/2022-09-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 30c305a60619..5cb40273942b 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
@@ -38,6 +38,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/2022-09-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 e920a7aea449..8c62af33de53 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
@@ -38,6 +38,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/2022-09-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 74d2be8c8f9d..f3f4191b681c 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
@@ -38,6 +38,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/2022-09-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 006206d9e155..c44af4e3d765 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
@@ -38,6 +38,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/2022-09-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 26d7a2f8a94f..f12e12fedf15 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
@@ -37,6 +37,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/2022-09-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 ca761388d06c..3a53ae2bcd2b 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
@@ -38,6 +38,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/2022-09-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 e632fc01bee1..ccb72c9f164e 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
@@ -37,6 +37,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/2022-09-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 6753273b2a29..e786894f0d4b 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
@@ -37,6 +37,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/2022-09-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 18d1454074c0..eb72489cca93 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
@@ -39,6 +39,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/2022-09-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 b14b75503202..7f0ff32a2394 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
@@ -37,6 +37,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/2022-09-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 f1fa7c7091a6..5d5d834a686c 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
@@ -37,6 +37,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/2022-09-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 9db399131515..fe2f2da7268a 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
@@ -38,6 +38,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/2022-09-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 652d74a41524..d991a15ed3e7 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
@@ -38,6 +38,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/2022-09-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 3a8a8a266739..5974de876828 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
@@ -37,6 +37,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/2022-09-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 69ad04bac9db..2e8cdf1bee62 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
@@ -37,6 +37,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/2022-09-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 90e4a2f5b79a..8f00dc118ab8 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
@@ -37,6 +37,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/2022-09-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 e7cbcb00e20c..03fbad9f9fd3 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
@@ -38,6 +38,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/2022-09-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 5c86b9c9328b..f349354938e2 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
@@ -37,6 +37,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/2022-09-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 9c7e8d5fde15..079b907cfe23 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
@@ -37,6 +37,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/2022-09-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 3025ab27f4a2..1280b6c6dcdf 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
@@ -37,6 +37,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/2022-09-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 3cfa7e4b62e9..f2f5dbf85cee 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
@@ -38,6 +38,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/2022-09-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 b9a737bd58f2..5571edc79489 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
@@ -38,6 +38,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/2022-09-01-preview/examples/ApiManagementListGatewayCertificateAuthorities.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 8d9f987a4f3c..e72557408fa2 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
@@ -38,6 +38,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/2022-09-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 6ab0b300eb04..31a604846c6e 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
@@ -37,6 +37,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/2022-09-01-preview/examples/ApiManagementListGateways.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 7b92757644fb..73816dbb554e 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
@@ -37,6 +37,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/2022-09-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 5932847c31e9..64012088dd35 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
@@ -39,6 +39,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/2022-09-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 87617f762c73..ac317fb9fd94 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
@@ -38,6 +38,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/2022-09-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 fda067f5af64..3718325c8777 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
@@ -38,6 +38,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/2022-09-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 db60101580b0..060dc46a38de 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
@@ -37,6 +37,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/2022-09-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 e0ff482191f0..8a42601465a0 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
@@ -37,6 +37,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/2022-09-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 028b9195ed80..a2edbd959ed7 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
@@ -37,6 +37,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/2022-09-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 586ec0384a4f..1063c7d6fa21 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
@@ -37,6 +37,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/2022-09-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 6820032e047a..b06c7f6ccb78 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
@@ -37,6 +37,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/2022-09-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 47a000ce2169..468521fadcb8 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
@@ -37,6 +37,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/2022-09-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 0dfee09c05b1..ee784e375aba 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
@@ -37,6 +37,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/2022-09-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 07f4b3f1f1da..b32ff443dca6 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
@@ -37,6 +37,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/2022-09-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 d2ca904c7c81..bedff7f1ed14 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
@@ -37,6 +37,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/2022-09-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 334c9ad40228..c54179cdedfa 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
@@ -34,6 +34,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/2022-09-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 2847762299ff..b56737a8061a 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
@@ -33,9 +33,10 @@ def main():
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/2022-09-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 c9e1b488bd57..e9394ca8a6ab 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
@@ -36,6 +36,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/2022-09-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 458ebc654fb9..8095f0f1ffac 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
@@ -37,6 +37,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/2022-09-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 cff7720f3348..f58e787d6065 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
@@ -33,9 +33,10 @@ def main():
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/2022-09-01-preview/examples/ApiManagementListPolicyFragments.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 eec36b1a63b9..773bdee02362 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
@@ -33,9 +33,10 @@ def main():
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/2022-09-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 17d50f2ffebb..88c9c779f877 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
@@ -37,6 +37,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/2022-09-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 04909492f7ec..e93300d46601 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
@@ -36,6 +36,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/2022-09-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 2f76ad8ec0ea..5781232ff84e 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
@@ -37,6 +37,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/2022-09-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 e134c7bb37b5..c002437311e3 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
@@ -36,6 +36,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/2022-09-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..6d06b601832f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_api_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_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="subid",
+ )
+
+ 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/2022-09-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 80bc2538664d..837db5c653d0 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
@@ -38,6 +38,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/2022-09-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..e3a89d48e0f8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_group_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_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="subid",
+ )
+
+ 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/2022-09-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 3580e5aebbfb..5865b8e8b13d 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
@@ -38,6 +38,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/2022-09-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 e347bd5dce93..75412dad012f 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
@@ -34,9 +34,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/2022-09-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 33b82741e99e..e8124ea6ae70 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
@@ -38,6 +38,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/2022-09-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 2706dd77b789..5976dad66351 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
@@ -38,6 +38,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/2022-09-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 4561d72abd55..60ff2aab9013 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
@@ -38,6 +38,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/2022-09-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 6f1f36d17879..fa023fd7c384 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
@@ -37,6 +37,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/2022-09-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 72fd6a36a6b2..b9d84533795f 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
@@ -37,6 +37,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/2022-09-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 11b94e6aac3b..c3ca2c50182a 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
@@ -37,6 +37,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/2022-09-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 a14c9047c307..c89acecb3606 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
@@ -36,6 +36,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/2022-09-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 1451741bd992..8eb1a5a0e0c5 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
@@ -37,6 +37,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/2022-09-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 e0a56998d27d..9270c54ee86c 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
@@ -34,6 +34,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/2022-09-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 2958214db4ff..63881c20a13c 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
@@ -36,6 +36,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/2022-09-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 7d854ceb5f05..eb7c352277ca 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
@@ -37,6 +37,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/2022-09-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 5202121663a8..70999e43a757 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
@@ -37,6 +37,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/2022-09-01-preview/examples/ApiManagementListSKUs-Dedicated.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 3acfe06bb65b..78272c99c2b8 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
@@ -34,6 +34,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/2022-09-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 ebfa1b3e0617..4b25ea3481bf 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
@@ -37,6 +37,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/2022-09-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..e87fec5220d2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_api_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_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="subid",
+ )
+
+ 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/2022-09-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..0669d517c9f3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_operation_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_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="subid",
+ )
+
+ 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/2022-09-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..3af9c019b2a6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_tag_product_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_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="subid",
+ )
+
+ 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/2022-09-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 40d99838501e..ba422702c807 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
@@ -37,6 +37,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/2022-09-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 ed3434dab130..906241e38062 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
@@ -37,6 +37,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/2022-09-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 204ee36e7639..05262ccc6798 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
@@ -37,6 +37,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/2022-09-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 bab572fc3ad2..f39fda6dea65 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
@@ -37,6 +37,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/2022-09-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 a83d11e492e9..348df4e3e8ed 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
@@ -37,6 +37,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/2022-09-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 16faf0b19a45..55d73a97a6b4 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
@@ -38,6 +38,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/2022-09-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 5ad428e274fc..a332c71d7290 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
@@ -38,6 +38,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/2022-09-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 54d898e2ecc9..4fea25c4e310 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
@@ -38,6 +38,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/2022-09-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 f22a5daac334..4768e0c55b71 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
@@ -37,6 +37,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/2022-09-01-preview/examples/ApiManagementListUsers.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..e3dcf829a624
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_operation_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_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="subid",
+ )
+
+ 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/2022-09-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..f91973610830
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_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.
+# --------------------------------------------------------------------------
+
+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="subid",
+ )
+
+ 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/2022-09-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..c689b4722bea
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_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_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="subid",
+ )
+
+ 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/2022-09-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..caf5e3015c40
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_releases.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_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="subid",
+ )
+
+ 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/2022-09-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..83ab54a29991
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_revisions.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_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="subid",
+ )
+
+ 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/2022-09-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..d66d85f710ca
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_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_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="subid",
+ )
+
+ 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/2022-09-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..11bf7665e8b5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_version_sets.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_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="subid",
+ )
+
+ 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/2022-09-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..8bab4b3aaefe
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_apis.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementListWorkspaceApis.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..dfb296434583
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_group_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_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="subid",
+ )
+
+ 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/2022-09-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..3470c510784c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_groups.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementListWorkspaceGroups.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..65c754d412fb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_named_values.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_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="subid",
+ )
+
+ 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/2022-09-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..ba0a092109a8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notification_recipient_emails.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_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="subid",
+ )
+
+ 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/2022-09-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..d5d9b94c59b3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notification_recipient_users.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_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="subid",
+ )
+
+ 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/2022-09-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..c3d0dff97d9e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_notifications.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_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="subid",
+ )
+
+ 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/2022-09-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..58e2c2759d33
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_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_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="subid",
+ )
+
+ 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/2022-09-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..c70e69ad57fe
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policy_fragment_references.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_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="subid",
+ )
+
+ 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/2022-09-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..40a27e17e500
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_policy_fragments.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_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="subid",
+ )
+
+ 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/2022-09-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..332b1db3716c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_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_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="subid",
+ )
+
+ 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/2022-09-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..02cb22d99470
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_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_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="subid",
+ )
+
+ 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/2022-09-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..caa703b73af0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_product_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_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="subid",
+ )
+
+ 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/2022-09-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..0feb498cfc70
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_products.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_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="subid",
+ )
+
+ 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/2022-09-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..72475f7c3f08
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_schemas.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_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="subid",
+ )
+
+ 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/2022-09-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..20fba1349a0f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_subscriptions.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_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="subid",
+ )
+
+ 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/2022-09-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..595ba5485751
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_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_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="subid",
+ )
+
+ 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/2022-09-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..fcbf8cc282f8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_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_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="subid",
+ )
+
+ 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/2022-09-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..2e07d26da8a2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_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_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="subid",
+ )
+
+ 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/2022-09-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..e160eba4916a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_tags.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_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="subid",
+ )
+
+ 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/2022-09-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..d5ec88218f1e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspaces.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_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="subid",
+ )
+
+ 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/2022-09-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 181e511138ee..d67e56435c6b 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
@@ -37,6 +37,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/2022-09-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 4c883d34b6ff..3478547f229d 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
@@ -37,6 +37,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/2022-09-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 f9e6de57dda9..8350f4806b36 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
@@ -41,6 +41,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/2022-09-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 2e5487f1d464..c93ae6e03a0d 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
@@ -37,7 +37,7 @@ def main():
"protocol": "HTTPS",
"protocolConfiguration": {
"HTTPConfiguration": {
- "headers": [{"name": "Authorization", "value": "******"}],
+ "headers": [{"name": "Authorization", "value": "Bearer myPreciousToken"}],
"method": "GET",
"validStatusCodes": [200, 204],
}
@@ -48,6 +48,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/2022-09-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 0cf3ef961fe8..1593a06e0777 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
@@ -37,6 +37,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/2022-09-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 0bb7926b93ee..e0e98fa919fd 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
@@ -36,6 +36,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/2022-09-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 7a460eeef162..1b8c055022df 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
@@ -36,6 +36,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/2022-09-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 bf87af0132e6..0f970733a4be 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
@@ -36,6 +36,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/2022-09-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 836caa935968..e4b845764c8a 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
@@ -44,6 +44,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/2022-09-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 c4b8ec30d35c..2d8121603cb7 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
@@ -37,6 +37,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/2022-09-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 d6af16ac902f..df646e44de7c 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
@@ -42,6 +42,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/2022-09-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 fa343331299c..bd6c0b0c69cc 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
@@ -45,6 +45,6 @@ def main():
print(response)
-# 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/2022-09-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 e9c6e7a71313..2c20e7782968 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
@@ -38,6 +38,6 @@ def main():
print(response)
-# 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/2022-09-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 bb38ff1d97bb..e0a8d76ff809 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
@@ -43,6 +43,6 @@ def main():
print(response)
-# 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/2022-09-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 cb1eeb5d1fdb..3179d4697594 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
@@ -39,6 +39,6 @@ def main():
print(response)
-# 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/2022-09-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 26dcbc69c449..04e4b677158a 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
@@ -37,6 +37,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/2022-09-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 f540097f24a9..cb30daba86ca 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
@@ -37,6 +37,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/2022-09-01-preview/examples/ApiManagementRefreshNamedValue.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..4b0dd073f1e6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_refresh_workspace_named_value.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_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="subid",
+ )
+
+ 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/2022-09-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 d3d91a4d2d03..f7b7f96531c0 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
@@ -43,6 +43,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/2022-09-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 c018027d71c0..306562395948 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
@@ -35,6 +35,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/2022-09-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 1caa8972fdc1..ac68401f15af 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
@@ -36,6 +36,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/2022-09-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 b600069da252..2d40bb73d080 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
@@ -33,6 +33,6 @@ def main():
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/2022-09-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 deb63159b553..61ad4e1bf5d6 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
@@ -36,6 +36,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/2022-09-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 712e80cd0de8..a881b2c1b8c0 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
@@ -36,6 +36,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/2022-09-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 a4f104f0038a..41848ef8879f 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
@@ -37,6 +37,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/2022-09-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 b8b4673865b8..a303c3cf195c 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
@@ -36,6 +36,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/2022-09-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 fc367c2d56d6..5a77031f64ab 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
@@ -36,6 +36,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/2022-09-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 60cc541d8120..628f96657371 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
@@ -36,6 +36,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/2022-09-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 9770821a13a5..59e133a44b6a 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
@@ -36,6 +36,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/2022-09-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 80b0d22d08c3..9b7b99f2eba3 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
@@ -36,6 +36,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/2022-09-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 8910b7c11cc0..7cb5272a41ac 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
@@ -37,6 +37,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/2022-09-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 373a41990c71..31ced3bbc1d3 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
@@ -37,6 +37,6 @@ def main():
print(response)
-# 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/2022-09-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 0408e6cf0244..9f0719489cc3 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
@@ -37,6 +37,6 @@ def main():
print(response)
-# 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/2022-09-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 c230d9014d9f..89809ed48548 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
@@ -37,6 +37,6 @@ def main():
print(response)
-# 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/2022-09-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 4dbbe0d11dd9..292cb8d53c30 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
@@ -37,6 +37,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/2022-09-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 538a36da647c..4d32a1ec2b6a 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
@@ -38,6 +38,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/2022-09-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 ad439455703f..5d9e1508287f 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
@@ -38,6 +38,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/2022-09-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 27a1ca7059fa..06b2a324e580 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
@@ -38,6 +38,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/2022-09-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 643644263ef3..2ebfe6248b70 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
@@ -41,6 +41,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/2022-09-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 06a50138df19..dcff4a1faa07 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
@@ -45,6 +45,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/2022-09-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 c4235628888f..38bb3f68b555 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
@@ -54,6 +54,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/2022-09-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 99a8f152c627..ca6a5bfecba5 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
@@ -40,6 +40,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/2022-09-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 58cbf8513bb7..91020356da92 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
@@ -63,6 +63,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/2022-09-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 65b8181ae6b8..ed7aece20232 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
@@ -45,6 +45,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/2022-09-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 fc2a38fb5601..733475d62971 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
@@ -45,6 +45,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/2022-09-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 8da01ef042dc..6b7a5823aef7 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
@@ -39,6 +39,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/2022-09-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 ab534aec7869..dd5a7903d6a3 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
@@ -46,6 +46,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/2022-09-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 59c42e08af73..1911d8da013f 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
@@ -44,6 +44,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/2022-09-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 50cbc523353f..7bb48bb59c37 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
@@ -39,6 +39,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/2022-09-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 30f3803cc406..41e6947b134e 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
@@ -53,6 +53,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/2022-09-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 12d74da6d9e6..f827de67488c 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
@@ -39,6 +39,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/2022-09-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 5ef0f005bf4f..b2c2e81d7155 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
@@ -46,6 +46,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/2022-09-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 dd345ac049ee..008db3238f24 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
@@ -39,6 +39,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/2022-09-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 70c3bcd462b3..cc4baf2e4052 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
@@ -39,6 +39,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/2022-09-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 c69c7af8e261..58e7c6a8b54b 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
@@ -39,6 +39,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/2022-09-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 98206d0fbfa9..2e1a48d97e30 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
@@ -41,6 +41,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/2022-09-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 74b4337436f9..971edae14ba2 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
@@ -41,6 +41,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/2022-09-01-preview/examples/ApiManagementUpdateOpenIdConnectProvider.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 5ef974ca315e..192ba0283c7d 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
@@ -59,6 +59,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/2022-09-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 99cac2b865c4..efa778a60a23 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
@@ -39,6 +39,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/2022-09-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 452f6e556670..5eded20b5b0c 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
@@ -39,6 +39,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/2022-09-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 11b01b730c7d..ac38ca6a95be 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
@@ -39,6 +39,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/2022-09-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 c974e955ad4b..6301e4c9bc54 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
@@ -38,6 +38,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/2022-09-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 27a0c558654e..bc5c652c60ee 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
@@ -39,6 +39,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/2022-09-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 6beed90f631c..e2448f6f0734 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
@@ -41,6 +41,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/2022-09-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 f395cc165bd9..6701098c5214 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
@@ -37,6 +37,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/2022-09-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 a0dbc08f4411..497158649012 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
@@ -58,6 +58,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/2022-09-01-preview/examples/ApiManagementUpdateServiceToNewVnetAndAZs.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 cc00f2191a52..30e589470673 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
@@ -39,6 +39,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/2022-09-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 d2a5cae36cb2..ffe5380958dc 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
@@ -39,6 +39,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/2022-09-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 53b6a2858fe9..e8364733a65e 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
@@ -44,6 +44,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/2022-09-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 ce4ff5932a7e..09c059410d55 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
@@ -39,6 +39,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/2022-09-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 8da61180f776..49f1602eb2bf 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
@@ -39,6 +39,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/2022-09-01-preview/examples/ApiManagementUpdateUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace.py
new file mode 100644
index 000000000000..bdad90f857d2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_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_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,
+ 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",
+ )
+
+ response = client.workspace.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ if_match="*",
+ parameters={"properties": {"description": "workspace 1", "displayName": "my workspace"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..59b361182036
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api.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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementUpdateWorkspaceApi.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..c761b91563f0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_api_operation.py
@@ -0,0 +1,69 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license 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="subid",
+ )
+
+ 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/2022-09-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..04f3861e900d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_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_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="subid",
+ )
+
+ 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/subid/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/2022-09-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..05f6e5195786
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementUpdateWorkspaceApiVersionSet.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..3ced4d990874
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_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_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="subid",
+ )
+
+ 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/2022-09-01-preview/examples/ApiManagementUpdateWorkspaceGroup.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..a7c1a940d464
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_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_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="subid",
+ )
+
+ 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/2022-09-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..f085e10ff2f5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_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_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="subid",
+ )
+
+ 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/2022-09-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..fabf99b1623e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_workspace_subscription.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_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="subid",
+ )
+
+ 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/2022-09-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..fff108661cbe
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_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_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="subid",
+ )
+
+ 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/2022-09-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 793650579dac..798e9e632a37 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
@@ -37,6 +37,6 @@ def main():
print(response)
-# 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/2022-09-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 c7a175e76d53..33ed54f7d379 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
@@ -37,6 +37,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/2022-09-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 76c6feddf22b..1b61ca9a2110 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
@@ -38,6 +38,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/2022-09-01-preview/examples/ApiManagementUserToken.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..f525b4d955e7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_named_value_list_value.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_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="subid",
+ )
+
+ 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/2022-09-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..4874ea8e8618
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_list_secrets.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_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="subid",
+ )
+
+ 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/2022-09-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..be55028f1db9
--- /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="subid",
+ )
+
+ response = client.workspace_subscription.regenerate_primary_key(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-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..2703d79a2a7a
--- /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="subid",
+ )
+
+ response = client.workspace_subscription.regenerate_secondary_key(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2022-09-01-preview/examples/ApiManagementWorkspaceSubscriptionRegenerateSecondaryKey.json
+if __name__ == "__main__":
+ main()