diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json
index e9a1ab81399b..00cc5f21c385 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json
@@ -1,11 +1,11 @@
{
- "commit": "1198b4b73bed8c941a51acb037f1531166aa6728",
+ "commit": "b7887215c459705bdf12ac755071034ef95ee210",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
- "autorest": "3.9.2",
+ "autorest": "3.9.7",
"use": [
- "@autorest/python@6.4.8",
- "@autorest/modelerfour@4.24.3"
+ "@autorest/python@6.7.1",
+ "@autorest/modelerfour@4.26.2"
],
- "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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --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..8b94498463b1 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
@@ -16,6 +16,7 @@
from ._configuration import ApiManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
+ AllPoliciesOperations,
ApiDiagnosticOperations,
ApiExportOperations,
ApiIssueAttachmentOperations,
@@ -76,11 +77,15 @@
PolicyDescriptionOperations,
PolicyFragmentOperations,
PolicyOperations,
+ PolicyRestrictionOperations,
+ PolicyRestrictionValidationsOperations,
PortalConfigOperations,
PortalRevisionOperations,
PortalSettingsOperations,
PrivateEndpointConnectionOperations,
+ ProductApiLinkOperations,
ProductApiOperations,
+ ProductGroupLinkOperations,
ProductGroupOperations,
ProductOperations,
ProductPolicyOperations,
@@ -94,7 +99,10 @@
SignInSettingsOperations,
SignUpSettingsOperations,
SubscriptionOperations,
+ TagApiLinkOperations,
+ TagOperationLinkOperations,
TagOperations,
+ TagProductLinkOperations,
TagResourceOperations,
TenantAccessGitOperations,
TenantAccessOperations,
@@ -105,6 +113,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:
@@ -117,6 +153,8 @@ class ApiManagementClient(
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""ApiManagement Client.
+ :ivar all_policies: AllPoliciesOperations operations
+ :vartype all_policies: azure.mgmt.apimanagement.operations.AllPoliciesOperations
:ivar api: ApiOperations operations
:vartype api: azure.mgmt.apimanagement.operations.ApiOperations
:ivar api_revision: ApiRevisionOperations operations
@@ -161,9 +199,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 +210,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 +236,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
@@ -245,6 +285,11 @@ class ApiManagementClient(
:vartype policy_description: azure.mgmt.apimanagement.operations.PolicyDescriptionOperations
:ivar policy_fragment: PolicyFragmentOperations operations
:vartype policy_fragment: azure.mgmt.apimanagement.operations.PolicyFragmentOperations
+ :ivar policy_restriction: PolicyRestrictionOperations operations
+ :vartype policy_restriction: azure.mgmt.apimanagement.operations.PolicyRestrictionOperations
+ :ivar policy_restriction_validations: PolicyRestrictionValidationsOperations operations
+ :vartype policy_restriction_validations:
+ azure.mgmt.apimanagement.operations.PolicyRestrictionValidationsOperations
:ivar portal_config: PortalConfigOperations operations
:vartype portal_config: azure.mgmt.apimanagement.operations.PortalConfigOperations
:ivar portal_revision: PortalRevisionOperations operations
@@ -275,6 +320,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 +343,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 +367,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.
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
- :keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
- default value may result in unsupported behavior.
+ :keyword api_version: Api Version. Default value is "2023-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.
@@ -343,6 +472,7 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
+ self.all_policies = AllPoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
self.api = ApiOperations(self._client, self._config, self._serialize, self._deserialize)
self.api_revision = ApiRevisionOperations(self._client, self._config, self._serialize, self._deserialize)
self.api_release = ApiReleaseOperations(self._client, self._config, self._serialize, self._deserialize)
@@ -376,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
)
@@ -389,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)
@@ -407,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(
@@ -443,6 +574,12 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize
)
self.policy_fragment = PolicyFragmentOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.policy_restriction = PolicyRestrictionOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.policy_restriction_validations = PolicyRestrictionValidationsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.portal_config = PortalConfigOperations(self._client, self._config, self._serialize, self._deserialize)
self.portal_revision = PortalRevisionOperations(self._client, self._config, self._serialize, self._deserialize)
self.portal_settings = PortalSettingsOperations(self._client, self._config, self._serialize, self._deserialize)
@@ -463,6 +600,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 +619,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 +640,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..2e55c1d5829a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py
@@ -27,16 +27,16 @@ class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-ma
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
- :param subscription_id: The ID of the target subscription. Required.
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
- :keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
- default value may result in unsupported behavior.
+ :keyword api_version: Api Version. Default value is "2023-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", "2023-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/_serialization.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py
index 842ae727fbbc..4bae2292227b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_serialization.py
@@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
- except ValueError:
- continue
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
@@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs):
:param data: The data to be serialized.
:param str data_type: The type to be serialized from.
+ :keyword bool skip_quote: Whether to skip quote the serialized result.
+ Defaults to False.
:rtype: str
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
@@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs):
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
- data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
- if not kwargs.get("skip_quote", False):
- data = [quote(str(d), safe="") for d in data]
- return str(self.serialize_iter(data, internal_data_type, **kwargs))
+ do_quote = not kwargs.get("skip_quote", False)
+ return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))
# Not a list, regular serialization
output = self.serialize_data(data, data_type, **kwargs)
@@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
+ :keyword bool do_quote: Whether to quote the serialized result of each iterable element.
+ Defaults to False.
:rtype: list, str
"""
if isinstance(data, str):
@@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
- except ValueError:
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
serialized.append(None)
+ if kwargs.get("do_quote", False):
+ serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]
+
if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
@@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
- except ValueError:
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
serialized[self.serialize_unicode(key)] = None
if "xml" in serialization_ctxt:
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py
index c4b00a9e8112..ffe974b35563 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py
@@ -6,7 +6,7 @@
# --------------------------------------------------------------------------
from abc import ABC
-from typing import List, TYPE_CHECKING, cast
+from typing import TYPE_CHECKING
from azure.core.pipeline.transport import HttpRequest
@@ -27,18 +27,6 @@ def _convert_request(request, files=None):
return request
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
-
-
class ApiManagementClientMixinABC(ABC):
"""DO NOT use this class. It is for internal typing use only."""
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py
index 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..9d2cf2afd63a 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
@@ -16,6 +16,7 @@
from .._serialization import Deserializer, Serializer
from ._configuration import ApiManagementClientConfiguration
from .operations import (
+ AllPoliciesOperations,
ApiDiagnosticOperations,
ApiExportOperations,
ApiIssueAttachmentOperations,
@@ -76,11 +77,15 @@
PolicyDescriptionOperations,
PolicyFragmentOperations,
PolicyOperations,
+ PolicyRestrictionOperations,
+ PolicyRestrictionValidationsOperations,
PortalConfigOperations,
PortalRevisionOperations,
PortalSettingsOperations,
PrivateEndpointConnectionOperations,
+ ProductApiLinkOperations,
ProductApiOperations,
+ ProductGroupLinkOperations,
ProductGroupOperations,
ProductOperations,
ProductPolicyOperations,
@@ -94,7 +99,10 @@
SignInSettingsOperations,
SignUpSettingsOperations,
SubscriptionOperations,
+ TagApiLinkOperations,
+ TagOperationLinkOperations,
TagOperations,
+ TagProductLinkOperations,
TagResourceOperations,
TenantAccessGitOperations,
TenantAccessOperations,
@@ -105,6 +113,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:
@@ -117,6 +153,8 @@ class ApiManagementClient(
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""ApiManagement Client.
+ :ivar all_policies: AllPoliciesOperations operations
+ :vartype all_policies: azure.mgmt.apimanagement.aio.operations.AllPoliciesOperations
:ivar api: ApiOperations operations
:vartype api: azure.mgmt.apimanagement.aio.operations.ApiOperations
:ivar api_revision: ApiRevisionOperations operations
@@ -164,9 +202,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 +213,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 +239,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
@@ -249,6 +289,12 @@ class ApiManagementClient(
azure.mgmt.apimanagement.aio.operations.PolicyDescriptionOperations
:ivar policy_fragment: PolicyFragmentOperations operations
:vartype policy_fragment: azure.mgmt.apimanagement.aio.operations.PolicyFragmentOperations
+ :ivar policy_restriction: PolicyRestrictionOperations operations
+ :vartype policy_restriction:
+ azure.mgmt.apimanagement.aio.operations.PolicyRestrictionOperations
+ :ivar policy_restriction_validations: PolicyRestrictionValidationsOperations operations
+ :vartype policy_restriction_validations:
+ azure.mgmt.apimanagement.aio.operations.PolicyRestrictionValidationsOperations
:ivar portal_config: PortalConfigOperations operations
:vartype portal_config: azure.mgmt.apimanagement.aio.operations.PortalConfigOperations
:ivar portal_revision: PortalRevisionOperations operations
@@ -280,6 +326,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 +351,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 +375,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.
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
- :keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
- default value may result in unsupported behavior.
+ :keyword api_version: Api Version. Default value is "2023-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.
@@ -350,6 +484,7 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
+ self.all_policies = AllPoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
self.api = ApiOperations(self._client, self._config, self._serialize, self._deserialize)
self.api_revision = ApiRevisionOperations(self._client, self._config, self._serialize, self._deserialize)
self.api_release = ApiReleaseOperations(self._client, self._config, self._serialize, self._deserialize)
@@ -383,9 +518,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 +528,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 +549,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(
@@ -450,6 +586,12 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize
)
self.policy_fragment = PolicyFragmentOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.policy_restriction = PolicyRestrictionOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
+ self.policy_restriction_validations = PolicyRestrictionValidationsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.portal_config = PortalConfigOperations(self._client, self._config, self._serialize, self._deserialize)
self.portal_revision = PortalRevisionOperations(self._client, self._config, self._serialize, self._deserialize)
self.portal_settings = PortalSettingsOperations(self._client, self._config, self._serialize, self._deserialize)
@@ -470,6 +612,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 +631,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 +652,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..ec4edb04c397 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
@@ -27,16 +27,16 @@ class ApiManagementClientConfiguration(Configuration): # pylint: disable=too-ma
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
- :param subscription_id: The ID of the target subscription. Required.
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
:type subscription_id: str
- :keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
- default value may result in unsupported behavior.
+ :keyword api_version: Api Version. Default value is "2023-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", "2023-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..58529f302fd4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py
@@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from ._all_policies_operations import AllPoliciesOperations
from ._api_operations import ApiOperations
from ._api_revision_operations import ApiRevisionOperations
from ._api_release_operations import ApiReleaseOperations
@@ -27,11 +28,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 +44,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
@@ -63,6 +65,8 @@
from ._policy_operations import PolicyOperations
from ._policy_description_operations import PolicyDescriptionOperations
from ._policy_fragment_operations import PolicyFragmentOperations
+from ._policy_restriction_operations import PolicyRestrictionOperations
+from ._policy_restriction_validations_operations import PolicyRestrictionValidationsOperations
from ._portal_config_operations import PortalConfigOperations
from ._portal_revision_operations import PortalRevisionOperations
from ._portal_settings_operations import PortalSettingsOperations
@@ -77,6 +81,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 +92,9 @@
from ._api_management_skus_operations import ApiManagementSkusOperations
from ._subscription_operations import SubscriptionOperations
from ._tag_resource_operations import TagResourceOperations
+from ._tag_api_link_operations import TagApiLinkOperations
+from ._tag_operation_link_operations import TagOperationLinkOperations
+from ._tag_product_link_operations import TagProductLinkOperations
from ._tenant_access_operations import TenantAccessOperations
from ._tenant_access_git_operations import TenantAccessGitOperations
from ._tenant_configuration_operations import TenantConfigurationOperations
@@ -94,13 +103,41 @@
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
from ._patch import patch_sdk as _patch_sdk
__all__ = [
+ "AllPoliciesOperations",
"ApiOperations",
"ApiRevisionOperations",
"ApiReleaseOperations",
@@ -122,11 +159,11 @@
"ApiWikisOperations",
"ApiExportOperations",
"ApiVersionSetOperations",
- "AuthorizationServerOperations",
"AuthorizationProviderOperations",
"AuthorizationOperations",
"AuthorizationLoginLinksOperations",
"AuthorizationAccessPolicyOperations",
+ "AuthorizationServerOperations",
"BackendOperations",
"CacheOperations",
"CertificateOperations",
@@ -138,6 +175,7 @@
"ApiManagementServiceSkusOperations",
"ApiManagementServiceOperations",
"DiagnosticOperations",
+ "DocumentationOperations",
"EmailTemplateOperations",
"GatewayOperations",
"GatewayHostnameConfigurationOperations",
@@ -158,6 +196,8 @@
"PolicyOperations",
"PolicyDescriptionOperations",
"PolicyFragmentOperations",
+ "PolicyRestrictionOperations",
+ "PolicyRestrictionValidationsOperations",
"PortalConfigOperations",
"PortalRevisionOperations",
"PortalSettingsOperations",
@@ -172,6 +212,8 @@
"ProductPolicyOperations",
"ProductWikiOperations",
"ProductWikisOperations",
+ "ProductApiLinkOperations",
+ "ProductGroupLinkOperations",
"QuotaByCounterKeysOperations",
"QuotaByPeriodKeysOperations",
"RegionOperations",
@@ -181,6 +223,9 @@
"ApiManagementSkusOperations",
"SubscriptionOperations",
"TagResourceOperations",
+ "TagApiLinkOperations",
+ "TagOperationLinkOperations",
+ "TagProductLinkOperations",
"TenantAccessOperations",
"TenantAccessGitOperations",
"TenantConfigurationOperations",
@@ -189,7 +234,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/_all_policies_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_all_policies_operations.py
new file mode 100644
index 000000000000..03f05a2d6595
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_all_policies_operations.py
@@ -0,0 +1,147 @@
+# 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._all_policies_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 AllPoliciesOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`all_policies` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> AsyncIterable["_models.AllPoliciesContract"]:
+ """Status of all policies of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: An iterator like instance of either AllPoliciesContract or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.AllPoliciesContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.AllPoliciesCollection] = kwargs.pop("cls", None)
+
+ error_map = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ request = build_list_by_service_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ 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("AllPoliciesCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ return pipeline_response
+
+ return AsyncItemPaged(get_next, extract_data)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/allPolicies"
+ }
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py
index 1a4fba479507..80bb6ebb759f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -462,7 +463,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DiagnosticContract")
@@ -653,7 +654,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DiagnosticContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py
index f9e4df4f7cc2..2697a4d28d24 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py
@@ -73,8 +73,8 @@ async def get(
instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
:type api_id: str
:param format: Format in which to export the Api Details to the Storage Blob with Sas Key valid
- for 5 minutes. Known values are: "swagger-link", "wsdl-link", "wadl-link", "openapi-link", and
- "openapi+json-link". Required.
+ for 5 minutes. New formats can be added in the future. Known values are: "swagger-link",
+ "wsdl-link", "wadl-link", "openapi-link", and "openapi+json-link". Required.
:type format: str or ~azure.mgmt.apimanagement.models.ExportFormat
:param export: Query parameter required to export the API details. "true" Required.
:type export: str or ~azure.mgmt.apimanagement.models.ExportApi
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py
index 60fd8d6bdac2..993bce67fbd6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -489,7 +490,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IssueAttachmentContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py
index 55a96b197ee6..c4e024f78cad 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -489,7 +490,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IssueCommentContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py
index 22208fa291de..0cc6f1c4e11f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -474,7 +475,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IssueContract")
@@ -665,7 +666,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IssueUpdateContract")
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..229ec59751c8 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
from azure.core.exceptions import (
@@ -35,7 +36,7 @@
class ApiManagementClientOperationsMixin(ApiManagementClientMixinABC):
- async def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long
+ async def _perform_connectivity_check_async_initial(
self,
resource_group_name: str,
service_name: str,
@@ -60,7 +61,7 @@ async def _perform_connectivity_check_async_initial( # pylint: disable=name-too
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(connectivity_check_request_params, (IO, bytes)):
+ if isinstance(connectivity_check_request_params, (IOBase, bytes)):
_content = connectivity_check_request_params
else:
_json = self._serialize.body(connectivity_check_request_params, "ConnectivityCheckRequest")
@@ -93,11 +94,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..b2f5944cb609 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -95,7 +96,7 @@ async def _restore_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceBackupRestoreParameters")
@@ -337,7 +338,7 @@ async def _backup_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceBackupRestoreParameters")
@@ -375,7 +376,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)
@@ -574,7 +575,7 @@ async def _create_or_update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceResource")
@@ -808,7 +809,7 @@ async def _update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceUpdateParameters")
@@ -841,11 +842,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 +1124,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 +1185,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:
@@ -1202,7 +1214,11 @@ def get_long_running_output(pipeline_response):
}
async def _migrate_to_stv2_initial(
- self, resource_group_name: str, service_name: str, **kwargs: Any
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[Union[_models.MigrateToStv2Contract, IO]] = None,
+ **kwargs: Any
) -> Optional[_models.ApiManagementServiceResource]:
error_map = {
401: ClientAuthenticationError,
@@ -1212,17 +1228,32 @@ async def _migrate_to_stv2_initial(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ if parameters is not None:
+ _json = self._serialize.body(parameters, "MigrateToStv2Contract")
+ else:
+ _json = None
+
request = build_migrate_to_stv2_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
template_url=self._migrate_to_stv2_initial.metadata["url"],
headers=_headers,
params=_params,
@@ -1259,9 +1290,91 @@ async def _migrate_to_stv2_initial(
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2"
}
+ @overload
+ async def begin_migrate_to_stv2(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[_models.MigrateToStv2Contract] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementServiceResource]:
+ """Upgrades an API Management service to the Stv2 platform. For details refer to
+ https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Default value is None.
+ :type parameters: ~azure.mgmt.apimanagement.models.MigrateToStv2Contract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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 ApiManagementServiceResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def begin_migrate_to_stv2(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[IO] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.ApiManagementServiceResource]:
+ """Upgrades an API Management service to the Stv2 platform. For details refer to
+ https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Default value is None.
+ :type parameters: IO
+ :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 ApiManagementServiceResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
@distributed_trace_async
async def begin_migrate_to_stv2(
- self, resource_group_name: str, service_name: str, **kwargs: Any
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[Union[_models.MigrateToStv2Contract, IO]] = None,
+ **kwargs: Any
) -> AsyncLROPoller[_models.ApiManagementServiceResource]:
"""Upgrades an API Management service to the Stv2 platform. For details refer to
https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
@@ -1272,6 +1385,12 @@ async def begin_migrate_to_stv2(
:type resource_group_name: str
:param service_name: The name of the API Management service. Required.
:type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Is either a
+ MigrateToStv2Contract type or a IO type. Default value is None.
+ :type parameters: ~azure.mgmt.apimanagement.models.MigrateToStv2Contract 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
@@ -1286,10 +1405,11 @@ async def begin_migrate_to_stv2(
~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
@@ -1298,7 +1418,9 @@ async def begin_migrate_to_stv2(
raw_result = await self._migrate_to_stv2_initial(
resource_group_name=resource_group_name,
service_name=service_name,
+ parameters=parameters,
api_version=api_version,
+ content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
@@ -1647,7 +1769,7 @@ async def check_name_availability(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceCheckNameAvailabilityParameters")
@@ -1746,7 +1868,7 @@ async def get_domain_ownership_identifier(
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier"
}
- async def _apply_network_configuration_updates_initial( # pylint: disable=name-too-long
+ async def _apply_network_configuration_updates_initial(
self,
resource_group_name: str,
service_name: str,
@@ -1771,7 +1893,7 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name-
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
if parameters is not None:
@@ -1824,7 +1946,7 @@ async def _apply_network_configuration_updates_initial( # pylint: disable=name-
}
@overload
- async def begin_apply_network_configuration_updates( # pylint: disable=name-too-long
+ async def begin_apply_network_configuration_updates(
self,
resource_group_name: str,
service_name: str,
@@ -1865,7 +1987,7 @@ async def begin_apply_network_configuration_updates( # pylint: disable=name-too
"""
@overload
- async def begin_apply_network_configuration_updates( # pylint: disable=name-too-long
+ async def begin_apply_network_configuration_updates(
self,
resource_group_name: str,
service_name: str,
@@ -1905,7 +2027,7 @@ async def begin_apply_network_configuration_updates( # pylint: disable=name-too
"""
@distributed_trace_async
- async def begin_apply_network_configuration_updates( # pylint: disable=name-too-long
+ async def begin_apply_network_configuration_updates(
self,
resource_group_name: str,
service_name: str,
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py
index c59441fc4931..bf1d2fb3f594 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -470,7 +471,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "OperationContract")
@@ -661,7 +662,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "OperationUpdateContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py
index 575575b9d0f0..26a1cd3c71dc 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -447,7 +448,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
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..8de586fd1dcc 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -335,7 +336,7 @@ async def _create_or_update_initial(
parameters: Union[_models.ApiCreateOrUpdateParameter, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.ApiContract]:
+ ) -> _models.ApiContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -349,12 +350,12 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiCreateOrUpdateParameter")
@@ -383,27 +384,34 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("ApiContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("ApiContract", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"
@@ -568,6 +576,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("ApiContract", pipeline_response)
if cls:
@@ -719,7 +731,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiUpdateContract")
@@ -767,8 +779,7 @@ async def update(
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"
}
- @distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
service_name: str,
@@ -777,26 +788,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
delete_revisions: Optional[bool] = None,
**kwargs: Any
) -> None:
- """Deletes the specified API of the API Management service instance.
-
- :param resource_group_name: The name of the resource group. The name is case insensitive.
- Required.
- :type resource_group_name: str
- :param service_name: The name of the API Management service. Required.
- :type service_name: str
- :param api_id: API revision identifier. Must be unique in the current API Management service
- instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
- :type api_id: str
- :param if_match: ETag of the Entity. ETag should match the current entity state from the header
- response of the GET request or it should be * for unconditional update. Required.
- :type if_match: str
- :param delete_revisions: Delete all revisions of the Api. Default value is None.
- :type delete_revisions: bool
- :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,
@@ -819,7 +810,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
if_match=if_match,
delete_revisions=delete_revisions,
api_version=api_version,
- template_url=self.delete.metadata["url"],
+ template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
@@ -833,15 +824,107 @@ async def delete( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
- if response.status_code not in [200, 204]:
+ if response.status_code not in [202, 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)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
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}/apis/{apiId}"
+ }
+
+ @distributed_trace_async
+ async def begin_delete(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ api_id: str,
+ if_match: str,
+ delete_revisions: Optional[bool] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[None]:
+ """Deletes the specified API of the API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param api_id: API revision identifier. Must be unique in the current API Management service
+ instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
+ :type api_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param delete_revisions: Delete all revisions of the Api. Default value is None.
+ :type delete_revisions: bool
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
+ :rtype: ~azure.core.polling.AsyncLROPoller[None]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._delete_initial( # type: ignore
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ api_id=api_id,
+ if_match=if_match,
+ delete_revisions=delete_revisions,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ 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
- delete.metadata = {
+ begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"
}
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py
index 1ed610ac38c7..86717ef4ddde 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -427,7 +428,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py
index 3209088fbb49..87579d432239 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -464,7 +465,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiReleaseContract")
@@ -655,7 +656,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiReleaseContract")
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..6ed67dcc70f8 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -336,7 +337,7 @@ async def _create_or_update_initial(
parameters: Union[_models.SchemaContract, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.SchemaContract]:
+ ) -> _models.SchemaContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -350,12 +351,12 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.SchemaContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "SchemaContract")
@@ -385,27 +386,34 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("SchemaContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("SchemaContract", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"
@@ -583,6 +591,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("SchemaContract", pipeline_response)
if cls:
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py
index b8585a855624..553f79622a32 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -464,7 +465,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "TagDescriptionCreateParameters")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py
index 31fbe10e986f..228ad1092e99 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -437,7 +438,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiVersionSetContract")
@@ -615,7 +616,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiVersionSetUpdateParameters")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py
index 7d0501a35e68..c4f0a2198fb6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_wiki_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -319,7 +320,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "WikiContract")
@@ -497,7 +498,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "WikiUpdateContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py
index f27278d3a0ec..b9bd8ca5d7a3 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_access_policy_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -402,7 +403,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationAccessPolicyContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py
index 7689d35a7822..db41c89c97cd 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_login_links_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -169,7 +170,7 @@ async def post(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationLoginRequestContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py
index 3787060a33f0..de0f1abdcf44 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -386,7 +387,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationContract")
@@ -638,7 +639,7 @@ async def confirm_consent_code( # pylint: disable=inconsistent-return-statement
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationConfirmConsentCodeRequestContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py
index b118ea2b89b1..60280a270097 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_provider_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -364,7 +365,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationProviderContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py
index ced04340ee0c..65ad4160ea52 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -433,7 +434,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationServerContract")
@@ -608,7 +609,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationServerUpdateContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py
index 3a065b2fc2ed..1f0dfdaca6b9 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -437,7 +438,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "BackendContract")
@@ -615,7 +616,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "BackendUpdateParameters")
@@ -847,7 +848,7 @@ async def reconnect( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
if parameters is not None:
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py
index 2681d55a6ba6..9a3e75a2982c 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -436,7 +437,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "CacheContract")
@@ -614,7 +615,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "CacheUpdateParameters")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py
index 6d093b06041b..8e4b0bae2ebc 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -456,7 +457,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py
index 9b74c349c357..1a1f75c6c6c8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -432,7 +433,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ContentItemContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py
index f3da96a9741c..dd911dd9c82e 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -352,7 +353,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ContentTypeContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py
index e0c85ae23482..fb142e5c0578 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -298,7 +299,7 @@ async def update( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalDelegationSettings")
@@ -450,7 +451,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalDelegationSettings")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py
index 9f30af6fa939..5ca5cec7d060 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -437,7 +438,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DiagnosticContract")
@@ -615,7 +616,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DiagnosticContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py
index 333766f61a94..0025ede6d20f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_documentation_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -437,7 +438,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DocumentationContract")
@@ -615,7 +616,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DocumentationUpdateContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py
index 21bbb49b633e..8b8ce4606943 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -476,7 +477,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "EmailTemplateUpdateParameters")
@@ -667,7 +668,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "EmailTemplateUpdateParameters")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py
index 5396b8dbac8a..d737093b74b6 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -370,7 +371,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
if parameters is not None:
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py
index 669da7b38a1d..53839b0ec46a 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -460,7 +461,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayCertificateAuthorityContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py
index a4ccb3975e8f..29ca1331185b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -464,7 +465,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayHostnameConfigurationContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py
index 10b0fb2e29a6..134478902f23 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -34,8 +35,11 @@
build_generate_token_request,
build_get_entity_tag_request,
build_get_request,
+ build_invalidate_debug_credentials_request,
build_list_by_service_request,
+ build_list_debug_credentials_request,
build_list_keys_request,
+ build_list_trace_request,
build_regenerate_key_request,
build_update_request,
)
@@ -439,7 +443,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayContract")
@@ -616,7 +620,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayContract")
@@ -917,7 +921,7 @@ async def regenerate_key( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayKeyRegenerationRequestContract")
@@ -1068,7 +1072,7 @@ async def generate_token(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayTokenRequestContract")
@@ -1111,3 +1115,380 @@ async def generate_token(
generate_token.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken"
}
+
+ @distributed_trace_async
+ async def invalidate_debug_credentials( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, gateway_id: str, **kwargs: Any
+ ) -> None:
+ """Action is invalidating all debug credentials issued for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :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_invalidate_debug_credentials_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ template_url=self.invalidate_debug_credentials.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, {})
+
+ invalidate_debug_credentials.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/invalidateDebugCredentials"
+ }
+
+ @overload
+ async def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: _models.GatewayListDebugCredentialsContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: IO,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Required.
+ :type parameters: IO
+ :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: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: Union[_models.GatewayListDebugCredentialsContract, IO],
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Is either a
+ GatewayListDebugCredentialsContract type or a IO type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContract 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: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :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.GatewayDebugCredentialsContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GatewayListDebugCredentialsContract")
+
+ request = build_list_debug_credentials_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ template_url=self.list_debug_credentials.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("GatewayDebugCredentialsContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_debug_credentials.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listDebugCredentials"
+ }
+
+ @overload
+ async def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: _models.GatewayListTraceContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListTraceContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: IO,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Required.
+ :type parameters: IO
+ :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: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: Union[_models.GatewayListTraceContract, IO],
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Is either a GatewayListTraceContract type or a IO
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListTraceContract 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: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :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[Dict[str, Any]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GatewayListTraceContract")
+
+ request = build_list_trace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ template_url=self.list_trace.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("{object}", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_trace.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listTrace"
+ }
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..d72bb6998abe 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -321,7 +322,7 @@ async def _create_or_update_initial(
parameters: Union[_models.GlobalSchemaContract, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.GlobalSchemaContract]:
+ ) -> _models.GlobalSchemaContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -335,12 +336,12 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.GlobalSchemaContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GlobalSchemaContract")
@@ -369,27 +370,34 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"
@@ -557,6 +565,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
if cls:
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py
index ee2184a609eb..007829f0abd8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -464,7 +465,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ResolverContract")
@@ -655,7 +656,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ResolverUpdateContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py
index f26a5f6032aa..6cdb883158a8 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_graph_ql_api_resolver_policy_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -479,7 +480,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py
index c332578e9abe..8e44f561d23f 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -439,7 +440,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GroupCreateParameters")
@@ -617,7 +618,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GroupUpdateParameters")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py
index 93d77489e3c6..2874dde01853 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -434,7 +435,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IdentityProviderCreateContract")
@@ -612,7 +613,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IdentityProviderUpdateParameters")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py
index 7f485bca50f3..c82d66c5751d 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -439,7 +440,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "LoggerContract")
@@ -617,7 +618,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "LoggerUpdateContract")
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..ad30929a65f0 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -332,7 +333,7 @@ async def _create_or_update_initial(
parameters: Union[_models.NamedValueCreateContract, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.NamedValueContract]:
+ ) -> _models.NamedValueContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -346,12 +347,12 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "NamedValueCreateContract")
@@ -380,27 +381,34 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("NamedValueContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("NamedValueContract", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"
@@ -562,6 +570,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("NamedValueContract", pipeline_response)
if cls:
@@ -616,7 +628,7 @@ async def _update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "NamedValueUpdateParameters")
@@ -657,6 +669,12 @@ 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"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -1037,6 +1055,12 @@ 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"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py
index 263a613ed53a..a35d7f516529 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -433,7 +434,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "OpenidConnectProviderContract")
@@ -608,7 +609,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "OpenidConnectProviderUpdateContract")
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..5ae91567544c 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,11 @@
# 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 io import IOBase
+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 +23,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 +64,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 +74,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 +96,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 +116,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"
@@ -303,7 +336,7 @@ async def _create_or_update_initial(
parameters: Union[_models.PolicyFragmentContract, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.PolicyFragmentContract]:
+ ) -> _models.PolicyFragmentContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -317,12 +350,12 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PolicyFragmentContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyFragmentContract")
@@ -351,30 +384,34 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
- 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 cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}"
@@ -539,6 +576,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
if cls:
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..0432b23e0dfb 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,11 @@
# 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 io import IOBase
+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 +22,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 +61,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 +73,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 +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.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"
@@ -392,7 +424,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_operations.py
new file mode 100644
index 000000000000..84b4b712b85a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_operations.py
@@ -0,0 +1,713 @@
+# 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 io import IOBase
+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._policy_restriction_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_entity_tag_request,
+ build_get_request,
+ build_list_by_service_request,
+ build_update_request,
+)
+from .._vendor import ApiManagementClientMixinABC
+
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class PolicyRestrictionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`policy_restriction` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> AsyncIterable["_models.PolicyRestrictionContract"]:
+ """Gets all policy restrictions of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: An iterator like instance of either PolicyRestrictionContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PolicyRestrictionContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyRestrictionCollection] = kwargs.pop("cls", None)
+
+ error_map = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ request = build_list_by_service_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ 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("PolicyRestrictionCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ return pipeline_response
+
+ return AsyncItemPaged(get_next, extract_data)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions"
+ }
+
+ @distributed_trace_async
+ async def get_entity_tag(
+ self, resource_group_name: str, service_name: str, policy_restriction_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the policy restriction in the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :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,
+ policy_restriction_id=policy_restriction_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}/policyRestrictions/{policyRestrictionId}"
+ }
+
+ @distributed_trace_async
+ async def get(
+ self, resource_group_name: str, service_name: str, policy_restriction_id: str, **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Get the policy restriction of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :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.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ 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("PolicyRestrictionContract", 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}/policyRestrictions/{policyRestrictionId}"
+ }
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: _models.PolicyRestrictionContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: IO,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: IO
+ :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: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: Union[_models.PolicyRestrictionContract, IO],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Is either a PolicyRestrictionContract type
+ or a IO type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract 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: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :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.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyRestrictionContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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("PolicyRestrictionContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyRestrictionContract", 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}/policyRestrictions/{policyRestrictionId}"
+ }
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: _models.PolicyRestrictionUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: IO,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: IO
+ :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: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: Union[_models.PolicyRestrictionUpdateContract, IO],
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Is either a PolicyRestrictionUpdateContract
+ type or a IO type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionUpdateContract 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: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :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.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyRestrictionUpdateContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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("PolicyRestrictionContract", 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}/policyRestrictions/{policyRestrictionId}"
+ }
+
+ @distributed_trace_async
+ async def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy restriction configuration of the Api Management Service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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,
+ policy_restriction_id=policy_restriction_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}/policyRestrictions/{policyRestrictionId}"
+ }
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_validations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_validations_operations.py
new file mode 100644
index 000000000000..4e1df134f987
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_restriction_validations_operations.py
@@ -0,0 +1,184 @@
+# 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, cast
+
+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_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ..._vendor import _convert_request
+from ...operations._policy_restriction_validations_operations import build_by_service_request
+from .._vendor import ApiManagementClientMixinABC
+
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class PolicyRestrictionValidationsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.aio.ApiManagementClient`'s
+ :attr:`policy_restriction_validations` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ async def _by_service_initial(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> Optional[_models.OperationResultContract]:
+ 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.OperationResultContract]] = kwargs.pop("cls", None)
+
+ request = build_by_service_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ template_url=self._by_service_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:
+ 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, response_headers)
+
+ return deserialized
+
+ _by_service_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/validatePolicies"
+ }
+
+ @distributed_trace_async
+ async def begin_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> AsyncLROPoller[_models.OperationResultContract]:
+ """Validate all policies of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :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 OperationResultContract or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.OperationResultContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._by_service_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+ 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_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/validatePolicies"
+ }
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..3302fe9f5ced 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,11 @@
# 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 io import IOBase
+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 +22,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 +61,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 +73,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 +93,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"
@@ -382,7 +415,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalConfigContract")
@@ -548,7 +581,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalConfigContract")
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..b53d2e3f4463 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -330,7 +331,7 @@ async def _create_or_update_initial(
portal_revision_id: str,
parameters: Union[_models.PortalRevisionContract, IO],
**kwargs: Any
- ) -> Optional[_models.PortalRevisionContract]:
+ ) -> _models.PortalRevisionContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -344,12 +345,12 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.PortalRevisionContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalRevisionContract")
@@ -377,17 +378,19 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [201, 202]:
+ if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -549,6 +552,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
if cls:
@@ -603,7 +610,7 @@ async def _update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalRevisionContract")
@@ -644,6 +651,12 @@ 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"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
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..e4e19e5a983d 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -251,7 +252,7 @@ async def _create_or_update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(private_endpoint_connection_request, (IO, bytes)):
+ if isinstance(private_endpoint_connection_request, (IOBase, bytes)):
_content = private_endpoint_connection_request
else:
_json = self._serialize.body(private_endpoint_connection_request, "PrivateEndpointConnectionRequest")
@@ -285,11 +286,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 +513,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..c69b787f8e15
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_link_operations.py
@@ -0,0 +1,496 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductApiLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..f7e1f162d2c3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_link_operations.py
@@ -0,0 +1,496 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductGroupLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py
index 114034b4a903..bca20164a763 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -449,7 +450,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ProductContract")
@@ -627,7 +628,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ProductUpdateParameters")
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..21fdcd15b165 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,11 @@
# 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 io import IOBase
+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 +22,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 +61,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 +76,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 +95,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"
@@ -421,7 +453,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py
index e616224e66f4..267f0f588208 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_wiki_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -319,7 +320,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "WikiContract")
@@ -497,7 +498,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "WikiUpdateContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py
index 813f9c808f4d..c06f6e0d4c2b 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -250,7 +251,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "QuotaCounterValueUpdateContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py
index 893702243da0..f31bd7ca4547 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -259,7 +260,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "QuotaCounterValueUpdateContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py
index 9f4234580f00..f0fb868aca57 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -297,7 +298,7 @@ async def update( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalSigninSettings")
@@ -449,7 +450,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalSigninSettings")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py
index 88fd34409587..ece601527b29 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -297,7 +298,7 @@ async def update( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalSignupSettings")
@@ -449,7 +450,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalSignupSettings")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py
index a2cc0057e43e..6033fb2b52d4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -483,7 +484,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "SubscriptionCreateParameters")
@@ -699,7 +700,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "SubscriptionUpdateParameters")
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..9d86249afa80
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagApiLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..5ec3008a82a2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operation_link_operations.py
@@ -0,0 +1,496 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagOperationLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py
index e83c610d6026..bcda7dc936bd 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -1711,7 +1712,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "TagCreateUpdateParameters")
@@ -1889,7 +1890,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "TagCreateUpdateParameters")
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..a9ad3ff4f03d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_product_link_operations.py
@@ -0,0 +1,496 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagProductLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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_access_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py
index 1928a8a90621..f64e873bdd11 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -425,7 +426,7 @@ async def create(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AccessInformationCreateParameters")
@@ -597,7 +598,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AccessInformationUpdateParameters")
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..2880da9fafc7 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
from azure.core.exceptions import (
@@ -84,7 +85,7 @@ async def _deploy_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DeployConfigurationParameters")
@@ -118,11 +119,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
@@ -343,7 +348,7 @@ async def _save_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "SaveConfigurationParameter")
@@ -377,11 +382,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
@@ -602,7 +611,7 @@ async def _validate_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DeployConfigurationParameters")
@@ -636,11 +645,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/_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py
index 570db6af5ad3..ee88cc3ded35 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py
@@ -6,7 +6,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+from io import IOBase
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,11 +21,13 @@
)
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
@@ -454,7 +457,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "UserCreateParameters")
@@ -633,7 +636,7 @@ async def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "UserUpdateParameters")
@@ -681,8 +684,7 @@ async def update(
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"
}
- @distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
service_name: str,
@@ -693,33 +695,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
app_type: Optional[Union[str, _models.AppType]] = None,
**kwargs: Any
) -> None:
- """Deletes specific user.
-
- :param resource_group_name: The name of the resource group. The name is case insensitive.
- Required.
- :type resource_group_name: str
- :param service_name: The name of the API Management service. Required.
- :type service_name: str
- :param user_id: User identifier. Must be unique in the current API Management service instance.
- Required.
- :type user_id: str
- :param if_match: ETag of the Entity. ETag should match the current entity state from the header
- response of the GET request or it should be * for unconditional update. Required.
- :type if_match: str
- :param delete_subscriptions: Whether to delete user's subscription or not. Default value is
- None.
- :type delete_subscriptions: bool
- :param notify: Send an Account Closed Email notification to the User. Default value is None.
- :type notify: bool
- :param app_type: Determines the type of application which send the create user request. Default
- is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
- None.
- :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
- :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,
@@ -744,7 +719,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
notify=notify,
app_type=app_type,
api_version=api_version,
- template_url=self.delete.metadata["url"],
+ template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
@@ -758,15 +733,118 @@ async def delete( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
- if response.status_code not in [200, 204]:
+ if response.status_code not in [202, 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)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
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}/users/{userId}"
+ }
+
+ @distributed_trace_async
+ async def begin_delete(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ user_id: str,
+ if_match: str,
+ delete_subscriptions: Optional[bool] = None,
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[None]:
+ """Deletes specific user.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param delete_subscriptions: Whether to delete user's subscription or not. Default value is
+ None.
+ :type delete_subscriptions: bool
+ :param notify: Send an Account Closed Email notification to the User. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
+ this operation to not poll, or pass in your own initialized polling object for a personal
+ polling strategy.
+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
+ :rtype: ~azure.core.polling.AsyncLROPoller[None]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._delete_initial( # type: ignore
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ user_id=user_id,
+ if_match=if_match,
+ delete_subscriptions=delete_subscriptions,
+ notify=notify,
+ app_type=app_type,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ 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
- delete.metadata = {
+ begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"
}
@@ -952,7 +1030,7 @@ async def get_shared_access_token(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "UserTokenParameters")
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..ec4c7a98773a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_operations.py
@@ -0,0 +1,847 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "OperationContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "OperationUpdateContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..93e9dbd34bab
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operation_policy_operations.py
@@ -0,0 +1,657 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..d015359a92fa
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_operations.py
@@ -0,0 +1,910 @@
+# 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 io import IOBase
+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
+ ) -> _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[_models.ApiContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiUpdateContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..3794972b0bd8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_policy_operations.py
@@ -0,0 +1,619 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..1c2b8cf50043
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_release_operations.py
@@ -0,0 +1,841 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiReleaseContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiReleaseContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..c7e142dcd6bd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_schema_operations.py
@@ -0,0 +1,740 @@
+# 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 io import IOBase
+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
+ ) -> _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[_models.SchemaContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SchemaContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+ 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..4db96f7f24c4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_api_version_set_operations.py
@@ -0,0 +1,783 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiVersionSetContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiVersionSetUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..e368243a98db
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_global_schema_operations.py
@@ -0,0 +1,709 @@
+# 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 io import IOBase
+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
+ ) -> _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[_models.GlobalSchemaContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GlobalSchemaContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ 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..ccc4677fdc57
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_group_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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GroupCreateParameters")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GroupUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..12c8f63ce9f8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_named_value_operations.py
@@ -0,0 +1,1211 @@
+# 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 io import IOBase
+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
+ ) -> _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[_models.NamedValueContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "NamedValueCreateContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "NamedValueUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ 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"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ 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..28b7f17ba8be
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_operations.py
@@ -0,0 +1,735 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "WorkspaceContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "WorkspaceContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..3bee0be385ef
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_policy_fragment_operations.py
@@ -0,0 +1,796 @@
+# 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 io import IOBase
+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
+ ) -> _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[_models.PolicyFragmentContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyFragmentContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+ 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..49d7531c912c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..cc82c7d9ab4c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_api_link_operations.py
@@ -0,0 +1,534 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductApiLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..712e209ca7c8
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_group_link_operations.py
@@ -0,0 +1,534 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductGroupLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..46af94451864
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_operations.py
@@ -0,0 +1,801 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..9a983c9381bb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_product_policy_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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..49e9eba9c223
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_subscription_operations.py
@@ -0,0 +1,1081 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SubscriptionCreateParameters")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ notify=notify,
+ if_match=if_match,
+ app_type=app_type,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SubscriptionUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ notify=notify,
+ app_type=app_type,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..e0304bef2042
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagApiLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..fe4e1b681c59
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operation_link_operations.py
@@ -0,0 +1,534 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagOperationLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..f5dace09e18d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_operations.py
@@ -0,0 +1,781 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagCreateUpdateParameters")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagCreateUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..2c76e2e0797c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_workspace_tag_product_link_operations.py
@@ -0,0 +1,534 @@
+# 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 io import IOBase
+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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagProductLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..6ce5da22e334 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py
@@ -12,6 +12,8 @@
from ._models_py3 import AccessInformationSecretsContract
from ._models_py3 import AccessInformationUpdateParameters
from ._models_py3 import AdditionalLocation
+from ._models_py3 import AllPoliciesCollection
+from ._models_py3 import AllPoliciesContract
from ._models_py3 import ApiCollection
from ._models_py3 import ApiContactInformation
from ._models_py3 import ApiContract
@@ -87,10 +89,14 @@
from ._models_py3 import AuthorizationServerUpdateContractProperties
from ._models_py3 import BackendAuthorizationHeaderCredentials
from ._models_py3 import BackendBaseParameters
+from ._models_py3 import BackendBaseParametersPool
+from ._models_py3 import BackendCircuitBreaker
from ._models_py3 import BackendCollection
from ._models_py3 import BackendContract
from ._models_py3 import BackendContractProperties
from ._models_py3 import BackendCredentialsContract
+from ._models_py3 import BackendPool
+from ._models_py3 import BackendPoolItem
from ._models_py3 import BackendProperties
from ._models_py3 import BackendProxyContract
from ._models_py3 import BackendReconnectContract
@@ -107,7 +113,10 @@
from ._models_py3 import CertificateContract
from ._models_py3 import CertificateCreateOrUpdateParameters
from ._models_py3 import CertificateInformation
+from ._models_py3 import CircuitBreakerFailureCondition
+from ._models_py3 import CircuitBreakerRule
from ._models_py3 import ClientSecretContract
+from ._models_py3 import ConfigurationApi
from ._models_py3 import ConnectivityCheckRequest
from ._models_py3 import ConnectivityCheckRequestDestination
from ._models_py3 import ConnectivityCheckRequestProtocolConfiguration
@@ -140,14 +149,18 @@
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
from ._models_py3 import GatewayContract
+from ._models_py3 import GatewayDebugCredentialsContract
from ._models_py3 import GatewayHostnameConfigurationCollection
from ._models_py3 import GatewayHostnameConfigurationContract
from ._models_py3 import GatewayKeyRegenerationRequestContract
from ._models_py3 import GatewayKeysContract
+from ._models_py3 import GatewayListDebugCredentialsContract
+from ._models_py3 import GatewayListTraceContract
from ._models_py3 import GatewayTokenContract
from ._models_py3 import GatewayTokenRequestContract
from ._models_py3 import GenerateSsoUrlResult
@@ -185,6 +198,7 @@
from ._models_py3 import LoggerCollection
from ._models_py3 import LoggerContract
from ._models_py3 import LoggerUpdateContract
+from ._models_py3 import MigrateToStv2Contract
from ._models_py3 import NamedValueCollection
from ._models_py3 import NamedValueContract
from ._models_py3 import NamedValueContractProperties
@@ -226,6 +240,11 @@
from ._models_py3 import PolicyDescriptionContract
from ._models_py3 import PolicyFragmentCollection
from ._models_py3 import PolicyFragmentContract
+from ._models_py3 import PolicyRestrictionCollection
+from ._models_py3 import PolicyRestrictionContract
+from ._models_py3 import PolicyRestrictionUpdateContract
+from ._models_py3 import PolicyWithComplianceCollection
+from ._models_py3 import PolicyWithComplianceContract
from ._models_py3 import PortalConfigCollection
from ._models_py3 import PortalConfigContract
from ._models_py3 import PortalConfigCorsProperties
@@ -250,10 +269,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 +327,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 +337,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 +367,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
@@ -354,6 +385,7 @@
from ._api_management_client_enums import AuthorizationMethod
from ._api_management_client_enums import AuthorizationType
from ._api_management_client_enums import BackendProtocol
+from ._api_management_client_enums import BackendType
from ._api_management_client_enums import BearerTokenSendingMethod
from ._api_management_client_enums import BearerTokenSendingMethods
from ._api_management_client_enums import CertificateConfigurationStoreName
@@ -368,9 +400,11 @@
from ._api_management_client_enums import ContentFormat
from ._api_management_client_enums import CreatedByType
from ._api_management_client_enums import DataMaskingMode
+from ._api_management_client_enums import DeveloperPortalStatus
from ._api_management_client_enums import ExportApi
from ._api_management_client_enums import ExportFormat
from ._api_management_client_enums import ExportResultFormat
+from ._api_management_client_enums import GatewayListDebugCredentialsContractPurpose
from ._api_management_client_enums import GrantType
from ._api_management_client_enums import GroupType
from ._api_management_client_enums import HostnameType
@@ -378,8 +412,12 @@
from ._api_management_client_enums import IdentityProviderType
from ._api_management_client_enums import IssueType
from ._api_management_client_enums import KeyType
+from ._api_management_client_enums import KeyVaultRefreshState
+from ._api_management_client_enums import LegacyApiState
+from ._api_management_client_enums import LegacyPortalStatus
from ._api_management_client_enums import LoggerType
from ._api_management_client_enums import Method
+from ._api_management_client_enums import MigrateToStv2Mode
from ._api_management_client_enums import NameAvailabilityReason
from ._api_management_client_enums import NatGatewayState
from ._api_management_client_enums import NotificationName
@@ -387,10 +425,12 @@
from ._api_management_client_enums import OperationNameFormat
from ._api_management_client_enums import Origin
from ._api_management_client_enums import PlatformVersion
+from ._api_management_client_enums import PolicyComplianceState
from ._api_management_client_enums import PolicyContentFormat
from ._api_management_client_enums import PolicyExportFormat
from ._api_management_client_enums import PolicyFragmentContentFormat
from ._api_management_client_enums import PolicyIdName
+from ._api_management_client_enums import PolicyRestrictionRequireBase
from ._api_management_client_enums import PolicyScopeContract
from ._api_management_client_enums import PortalRevisionStatus
from ._api_management_client_enums import PortalSettingsCspMode
@@ -426,6 +466,8 @@
"AccessInformationSecretsContract",
"AccessInformationUpdateParameters",
"AdditionalLocation",
+ "AllPoliciesCollection",
+ "AllPoliciesContract",
"ApiCollection",
"ApiContactInformation",
"ApiContract",
@@ -501,10 +543,14 @@
"AuthorizationServerUpdateContractProperties",
"BackendAuthorizationHeaderCredentials",
"BackendBaseParameters",
+ "BackendBaseParametersPool",
+ "BackendCircuitBreaker",
"BackendCollection",
"BackendContract",
"BackendContractProperties",
"BackendCredentialsContract",
+ "BackendPool",
+ "BackendPoolItem",
"BackendProperties",
"BackendProxyContract",
"BackendReconnectContract",
@@ -521,7 +567,10 @@
"CertificateContract",
"CertificateCreateOrUpdateParameters",
"CertificateInformation",
+ "CircuitBreakerFailureCondition",
+ "CircuitBreakerRule",
"ClientSecretContract",
+ "ConfigurationApi",
"ConnectivityCheckRequest",
"ConnectivityCheckRequestDestination",
"ConnectivityCheckRequestProtocolConfiguration",
@@ -554,14 +603,18 @@
"ErrorFieldContract",
"ErrorResponse",
"ErrorResponseBody",
+ "FailureStatusCodeRange",
"GatewayCertificateAuthorityCollection",
"GatewayCertificateAuthorityContract",
"GatewayCollection",
"GatewayContract",
+ "GatewayDebugCredentialsContract",
"GatewayHostnameConfigurationCollection",
"GatewayHostnameConfigurationContract",
"GatewayKeyRegenerationRequestContract",
"GatewayKeysContract",
+ "GatewayListDebugCredentialsContract",
+ "GatewayListTraceContract",
"GatewayTokenContract",
"GatewayTokenRequestContract",
"GenerateSsoUrlResult",
@@ -599,6 +652,7 @@
"LoggerCollection",
"LoggerContract",
"LoggerUpdateContract",
+ "MigrateToStv2Contract",
"NamedValueCollection",
"NamedValueContract",
"NamedValueContractProperties",
@@ -640,6 +694,11 @@
"PolicyDescriptionContract",
"PolicyFragmentCollection",
"PolicyFragmentContract",
+ "PolicyRestrictionCollection",
+ "PolicyRestrictionContract",
+ "PolicyRestrictionUpdateContract",
+ "PolicyWithComplianceCollection",
+ "PolicyWithComplianceContract",
"PortalConfigCollection",
"PortalConfigContract",
"PortalConfigCorsProperties",
@@ -664,10 +723,14 @@
"PrivateLinkResource",
"PrivateLinkResourceListResult",
"PrivateLinkServiceConnectionState",
+ "ProductApiLinkCollection",
+ "ProductApiLinkContract",
"ProductCollection",
"ProductContract",
"ProductContractProperties",
"ProductEntityBaseParameters",
+ "ProductGroupLinkCollection",
+ "ProductGroupLinkContract",
"ProductTagResourceContractProperties",
"ProductUpdateParameters",
"ProductUpdateProperties",
@@ -718,6 +781,8 @@
"SubscriptionUpdateParameters",
"SubscriptionsDelegationSettingsProperties",
"SystemData",
+ "TagApiLinkCollection",
+ "TagApiLinkContract",
"TagCollection",
"TagContract",
"TagCreateUpdateParameters",
@@ -726,6 +791,10 @@
"TagDescriptionContract",
"TagDescriptionContractProperties",
"TagDescriptionCreateParameters",
+ "TagOperationLinkCollection",
+ "TagOperationLinkContract",
+ "TagProductLinkCollection",
+ "TagProductLinkContract",
"TagResourceCollection",
"TagResourceContract",
"TagResourceContractProperties",
@@ -752,6 +821,8 @@
"WikiContract",
"WikiDocumentationContract",
"WikiUpdateContract",
+ "WorkspaceCollection",
+ "WorkspaceContract",
"X509CertificateName",
"AccessIdName",
"AccessType",
@@ -767,6 +838,7 @@
"AuthorizationMethod",
"AuthorizationType",
"BackendProtocol",
+ "BackendType",
"BearerTokenSendingMethod",
"BearerTokenSendingMethods",
"CertificateConfigurationStoreName",
@@ -781,9 +853,11 @@
"ContentFormat",
"CreatedByType",
"DataMaskingMode",
+ "DeveloperPortalStatus",
"ExportApi",
"ExportFormat",
"ExportResultFormat",
+ "GatewayListDebugCredentialsContractPurpose",
"GrantType",
"GroupType",
"HostnameType",
@@ -791,8 +865,12 @@
"IdentityProviderType",
"IssueType",
"KeyType",
+ "KeyVaultRefreshState",
+ "LegacyApiState",
+ "LegacyPortalStatus",
"LoggerType",
"Method",
+ "MigrateToStv2Mode",
"NameAvailabilityReason",
"NatGatewayState",
"NotificationName",
@@ -800,10 +878,12 @@
"OperationNameFormat",
"Origin",
"PlatformVersion",
+ "PolicyComplianceState",
"PolicyContentFormat",
"PolicyExportFormat",
"PolicyFragmentContentFormat",
"PolicyIdName",
+ "PolicyRestrictionRequireBase",
"PolicyScopeContract",
"PortalRevisionStatus",
"PortalSettingsCspMode",
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..e3c38ddb624e 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
@@ -76,6 +76,8 @@ class ApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
SOAP = "soap"
WEBSOCKET = "websocket"
GRAPHQL = "graphql"
+ ODATA = "odata"
+ GRPC = "grpc"
class AppType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -134,6 +136,15 @@ class BackendProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The Backend is a SOAP service."""
+class BackendType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Type of the backend. A backend can be either Single or Pool."""
+
+ SINGLE = "Single"
+ """supports single backend"""
+ POOL = "Pool"
+ """supports pool backend"""
+
+
class BearerTokenSendingMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""BearerTokenSendingMethod."""
@@ -228,7 +239,9 @@ class ConnectivityStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
class ContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta):
- """Format of the Content in which the API is getting imported."""
+ """Format of the Content in which the API is getting imported. New formats can be added in the
+ future.
+ """
WADL_XML = "wadl-xml"
"""The contents are inline and Content type is a WADL document."""
@@ -252,6 +265,14 @@ class ContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The OpenAPI 3.0 JSON document is hosted on a publicly accessible internet address."""
GRAPHQL_LINK = "graphql-link"
"""The GraphQL API endpoint hosted on a publicly accessible internet address."""
+ ODATA = "odata"
+ """The contents are inline and Content Type is a OData XML Document."""
+ ODATA_LINK = "odata-link"
+ """The OData metadata document hosted on a publicly accessible internet address."""
+ GRPC = "grpc"
+ """The contents are inline and Content Type is a gRPC protobuf file."""
+ GRPC_LINK = "grpc-link"
+ """The gRPC protobuf file is hosted on a publicly accessible internet address."""
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -272,6 +293,15 @@ class DataMaskingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Hide the presence of an entity."""
+class DeveloperPortalStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Status of developer portal in this API Management service."""
+
+ ENABLED = "Enabled"
+ """Developer Portal is enabled for the service."""
+ DISABLED = "Disabled"
+ """Developer Portal is disabled for the service."""
+
+
class ExportApi(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""ExportApi."""
@@ -310,6 +340,13 @@ class ExportResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Export the API Definition in OpenAPI Specification 3.0 to Storage Blob."""
+class GatewayListDebugCredentialsContractPurpose(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Purpose of debug credential."""
+
+ TRACING = "tracing"
+ """The tracing purpose."""
+
+
class GrantType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""GrantType."""
@@ -340,6 +377,7 @@ class HostnameType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
MANAGEMENT = "Management"
SCM = "Scm"
DEVELOPER_PORTAL = "DeveloperPortal"
+ CONFIGURATION_API = "ConfigurationApi"
class HttpCorrelationProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -392,6 +430,39 @@ class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
SECONDARY = "secondary"
+class KeyVaultRefreshState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """KeyVaultRefreshState."""
+
+ TRUE = "true"
+ """Entities for which KeyVault refresh failed."""
+ FALSE = "false"
+ """Entities for which KeyVault refresh succeeded"""
+
+
+class LegacyApiState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Indication whether or not the legacy Configuration API (v1) should be exposed on the API
+ Management service. Value is optional but must be 'Enabled' or 'Disabled'. If 'Disabled',
+ legacy Configuration API (v1) will not be available for self-hosted gateways. Default value is
+ 'Enabled'.
+ """
+
+ ENABLED = "Enabled"
+ """Legacy Configuration API (v1) is enabled for the service and self-hosted gateways can connect
+ #: to it."""
+ DISABLED = "Disabled"
+ """Legacy Configuration API (v1) is disabled for the service and self-hosted gateways can not
+ #: connect to it."""
+
+
+class LegacyPortalStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Status of legacy portal in the API Management service."""
+
+ ENABLED = "Enabled"
+ """Legacy Portal is enabled for the service."""
+ DISABLED = "Disabled"
+ """Legacy Portal is disabled for the service."""
+
+
class LoggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Logger type."""
@@ -410,6 +481,18 @@ class Method(str, Enum, metaclass=CaseInsensitiveEnumMeta):
POST = "POST"
+class MigrateToStv2Mode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Mode of Migration to stv2. Default is PreserveIp."""
+
+ PRESERVE_IP = "PreserveIp"
+ """Migrate API Management service to stv2 from stv1, by reserving the IP Address of the service.
+ #: This will have a downtime of upto 15 minutes, while the IP address is getting migrate to new
+ #: infrastructure."""
+ NEW_IP = "NewIP"
+ """Migrate API Management service to stv2 from stv1. This will have no downtime as the service
+ #: configuration will be migrated to new infrastructure, but the IP address will changed."""
+
+
class NameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Invalid indicates the name provided does not match the resource provider’s naming requirements
(incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is
@@ -492,6 +575,19 @@ class PlatformVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Platform running the service on Single Tenant V2 platform."""
MTV1 = "mtv1"
"""Platform running the service on Multi Tenant V1 platform."""
+ STV2_1 = "stv2.1"
+ """Platform running the service on Single Tenant V2 platform on newer Hardware."""
+
+
+class PolicyComplianceState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Policy Restriction Compliance State."""
+
+ PENDING = "Pending"
+ """The policy restriction compliance state has not yet been determined."""
+ NON_COMPLIANT = "NonCompliant"
+ """The scope in restriction is out of compliance."""
+ COMPLIANT = "Compliant"
+ """The scope in restriction is in compliance."""
class PolicyContentFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -533,6 +629,15 @@ class PolicyIdName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
POLICY = "policy"
+class PolicyRestrictionRequireBase(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Indicates if base policy should be enforced for the policy document."""
+
+ TRUE = "true"
+ """The policy is required to have base policy"""
+ FALSE = "false"
+ """The policy does not require to have base policy"""
+
+
class PolicyScopeContract(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""PolicyScopeContract."""
@@ -674,6 +779,10 @@ class SkuType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Consumption SKU of Api Management."""
ISOLATED = "Isolated"
"""Isolated SKU of Api Management."""
+ BASIC_V2 = "BasicV2"
+ """BasicV2 SKU of Api Management."""
+ STANDARD_V2 = "StandardV2"
+ """StandardV2 SKU of Api Management."""
class SoapApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
@@ -684,6 +793,7 @@ class SoapApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
* ``graphql`` creates GraphQL API.
+ New types can be added in the future.
"""
SOAP_TO_REST = "http"
@@ -694,6 +804,10 @@ class SoapApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Imports the API having a Websocket front end."""
GRAPH_QL = "graphql"
"""Imports the API having a GraphQL front end."""
+ O_DATA = "odata"
+ """Imports the API having a OData front end."""
+ G_RPC = "grpc"
+ """Imports the API having a gRPC front end."""
class State(str, Enum, metaclass=CaseInsensitiveEnumMeta):
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..374fbc1dd0d4 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
"""
@@ -435,6 +435,91 @@ def __init__(
self.platform_version = None
+class AllPoliciesCollection(_serialization.Model):
+ """The response of All Policies.
+
+ :ivar value: AllPolicies Contract value.
+ :vartype value: list[~azure.mgmt.apimanagement.models.AllPoliciesContract]
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[AllPoliciesContract]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.AllPoliciesContract"]] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: AllPolicies Contract value.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.AllPoliciesContract]
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.next_link = next_link
+
+
+class AllPoliciesContract(ProxyResource):
+ """AllPolicies Contract details.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar id: Fully qualified resource ID for the resource. Ex -
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ :vartype id: str
+ :ivar name: The name of the resource.
+ :vartype name: str
+ :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
+ "Microsoft.Storage/storageAccounts".
+ :vartype type: str
+ :ivar reference_policy_id: Policy Identifier.
+ :vartype reference_policy_id: str
+ :ivar compliance_state: Policy Restriction Compliance State. Known values are: "Pending",
+ "NonCompliant", and "Compliant".
+ :vartype compliance_state: str or ~azure.mgmt.apimanagement.models.PolicyComplianceState
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ "reference_policy_id": {"key": "properties.referencePolicyId", "type": "str"},
+ "compliance_state": {"key": "properties.complianceState", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ reference_policy_id: Optional[str] = None,
+ compliance_state: Optional[Union[str, "_models.PolicyComplianceState"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword reference_policy_id: Policy Identifier.
+ :paramtype reference_policy_id: str
+ :keyword compliance_state: Policy Restriction Compliance State. Known values are: "Pending",
+ "NonCompliant", and "Compliant".
+ :paramtype compliance_state: str or ~azure.mgmt.apimanagement.models.PolicyComplianceState
+ """
+ super().__init__(**kwargs)
+ self.reference_policy_id = reference_policy_id
+ self.compliance_state = compliance_state
+
+
class ApiCollection(_serialization.Model):
"""Paged API list representation.
@@ -527,7 +612,8 @@ class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attribute
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
:vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:ivar api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -569,6 +655,8 @@ class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attribute
:vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol]
:ivar api_version_set: Version set details.
:vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
@@ -583,6 +671,7 @@ class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attribute
"display_name": {"max_length": 300, "min_length": 1},
"service_url": {"max_length": 2000},
"path": {"max_length": 400},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -616,6 +705,7 @@ class ApiContract(ProxyResource): # pylint: disable=too-many-instance-attribute
"path": {"key": "properties.path", "type": "str"},
"protocols": {"key": "properties.protocols", "type": "[str]"},
"api_version_set": {"key": "properties.apiVersionSet", "type": "ApiVersionSetContractDetails"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__( # pylint: disable=too-many-locals
@@ -652,7 +742,8 @@ def __init__( # pylint: disable=too-many-locals
:keyword subscription_key_parameter_names: Protocols over which API is made available.
:paramtype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
:paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:keyword api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -715,6 +806,7 @@ def __init__( # pylint: disable=too-many-locals
self.path = path
self.protocols = protocols
self.api_version_set = api_version_set
+ self.provisioning_state = None
class ApiEntityBaseContract(_serialization.Model): # pylint: disable=too-many-instance-attributes
@@ -730,7 +822,8 @@ class ApiEntityBaseContract(_serialization.Model): # pylint: disable=too-many-i
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
:vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:ivar api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -816,7 +909,8 @@ def __init__(
:keyword subscription_key_parameter_names: Protocols over which API is made available.
:paramtype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
:paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:keyword api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -875,7 +969,8 @@ class ApiContractProperties(ApiEntityBaseContract): # pylint: disable=too-many-
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
:vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:ivar api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -917,6 +1012,8 @@ class ApiContractProperties(ApiEntityBaseContract): # pylint: disable=too-many-
:vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol]
:ivar api_version_set: Version set details.
:vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
@@ -928,6 +1025,7 @@ class ApiContractProperties(ApiEntityBaseContract): # pylint: disable=too-many-
"display_name": {"max_length": 300, "min_length": 1},
"service_url": {"max_length": 2000},
"path": {"required": True, "max_length": 400},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -955,6 +1053,7 @@ class ApiContractProperties(ApiEntityBaseContract): # pylint: disable=too-many-
"path": {"key": "path", "type": "str"},
"protocols": {"key": "protocols", "type": "[str]"},
"api_version_set": {"key": "apiVersionSet", "type": "ApiVersionSetContractDetails"},
+ "provisioning_state": {"key": "provisioningState", "type": "str"},
}
def __init__(
@@ -991,7 +1090,8 @@ def __init__(
:keyword subscription_key_parameter_names: Protocols over which API is made available.
:paramtype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
:paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:keyword api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -1055,6 +1155,7 @@ def __init__(
self.path = path
self.protocols = protocols
self.api_version_set = api_version_set
+ self.provisioning_state = None
class ApiContractUpdateProperties(ApiEntityBaseContract): # pylint: disable=too-many-instance-attributes
@@ -1070,7 +1171,8 @@ class ApiContractUpdateProperties(ApiEntityBaseContract): # pylint: disable=too
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
:vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:ivar api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -1177,7 +1279,8 @@ def __init__(
:keyword subscription_key_parameter_names: Protocols over which API is made available.
:paramtype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
:paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:keyword api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -1249,7 +1352,8 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
:vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:ivar api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -1291,11 +1395,14 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
:vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol]
:ivar api_version_set: Version set details.
:vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
:ivar value: Content value when Importing an API.
:vartype value: str
- :ivar format: Format of the Content in which the API is getting imported. Known values are:
- "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", "wsdl-link",
- "openapi", "openapi+json", "openapi-link", "openapi+json-link", and "graphql-link".
+ :ivar format: Format of the Content in which the API is getting imported. New formats can be
+ added in the future. Known values are: "wadl-xml", "wadl-link-json", "swagger-json",
+ "swagger-link-json", "wsdl", "wsdl-link", "openapi", "openapi+json", "openapi-link",
+ "openapi+json-link", "graphql-link", "odata", "odata-link", "grpc", and "grpc-link".
:vartype format: str or ~azure.mgmt.apimanagement.models.ContentFormat
:ivar wsdl_selector: Criteria to limit import of WSDL to a subset of the document.
:vartype wsdl_selector:
@@ -1306,8 +1413,9 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
* ``http`` creates a REST API
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
- * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and
- "graphql".
+ * ``graphql`` creates GraphQL API.
+ New types can be added in the future. Known values are: "http", "soap", "websocket",
+ "graphql", "odata", and "grpc".
:vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType
:ivar translate_required_query_parameters_conduct: Strategy of translating required query
parameters to template ones. By default has value 'template'. Possible values: 'template',
@@ -1325,6 +1433,7 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
"display_name": {"max_length": 300, "min_length": 1},
"service_url": {"max_length": 2000},
"path": {"max_length": 400},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -1355,6 +1464,7 @@ class ApiCreateOrUpdateParameter(_serialization.Model): # pylint: disable=too-m
"path": {"key": "properties.path", "type": "str"},
"protocols": {"key": "properties.protocols", "type": "[str]"},
"api_version_set": {"key": "properties.apiVersionSet", "type": "ApiVersionSetContractDetails"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"value": {"key": "properties.value", "type": "str"},
"format": {"key": "properties.format", "type": "str"},
"wsdl_selector": {"key": "properties.wsdlSelector", "type": "ApiCreateOrUpdatePropertiesWsdlSelector"},
@@ -1406,7 +1516,8 @@ def __init__( # pylint: disable=too-many-locals
:keyword subscription_key_parameter_names: Protocols over which API is made available.
:paramtype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
:paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:keyword api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -1448,9 +1559,10 @@ def __init__( # pylint: disable=too-many-locals
:paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails
:keyword value: Content value when Importing an API.
:paramtype value: str
- :keyword format: Format of the Content in which the API is getting imported. Known values are:
- "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", "wsdl-link",
- "openapi", "openapi+json", "openapi-link", "openapi+json-link", and "graphql-link".
+ :keyword format: Format of the Content in which the API is getting imported. New formats can be
+ added in the future. Known values are: "wadl-xml", "wadl-link-json", "swagger-json",
+ "swagger-link-json", "wsdl", "wsdl-link", "openapi", "openapi+json", "openapi-link",
+ "openapi+json-link", "graphql-link", "odata", "odata-link", "grpc", and "grpc-link".
:paramtype format: str or ~azure.mgmt.apimanagement.models.ContentFormat
:keyword wsdl_selector: Criteria to limit import of WSDL to a subset of the document.
:paramtype wsdl_selector:
@@ -1461,8 +1573,9 @@ def __init__( # pylint: disable=too-many-locals
* ``http`` creates a REST API
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
- * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and
- "graphql".
+ * ``graphql`` creates GraphQL API.
+ New types can be added in the future. Known values are: "http", "soap", "websocket",
+ "graphql", "odata", and "grpc".
:paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType
:keyword translate_required_query_parameters_conduct: Strategy of translating required query
parameters to template ones. By default has value 'template'. Possible values: 'template',
@@ -1492,6 +1605,7 @@ def __init__( # pylint: disable=too-many-locals
self.path = path
self.protocols = protocols
self.api_version_set = api_version_set
+ self.provisioning_state = None
self.value = value
self.format = format
self.wsdl_selector = wsdl_selector
@@ -1514,7 +1628,8 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
:vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:ivar api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -1556,11 +1671,14 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
:vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol]
:ivar api_version_set: Version set details.
:vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
:ivar value: Content value when Importing an API.
:vartype value: str
- :ivar format: Format of the Content in which the API is getting imported. Known values are:
- "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", "wsdl-link",
- "openapi", "openapi+json", "openapi-link", "openapi+json-link", and "graphql-link".
+ :ivar format: Format of the Content in which the API is getting imported. New formats can be
+ added in the future. Known values are: "wadl-xml", "wadl-link-json", "swagger-json",
+ "swagger-link-json", "wsdl", "wsdl-link", "openapi", "openapi+json", "openapi-link",
+ "openapi+json-link", "graphql-link", "odata", "odata-link", "grpc", and "grpc-link".
:vartype format: str or ~azure.mgmt.apimanagement.models.ContentFormat
:ivar wsdl_selector: Criteria to limit import of WSDL to a subset of the document.
:vartype wsdl_selector:
@@ -1571,8 +1689,9 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
* ``http`` creates a REST API
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
- * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and
- "graphql".
+ * ``graphql`` creates GraphQL API.
+ New types can be added in the future. Known values are: "http", "soap", "websocket",
+ "graphql", "odata", and "grpc".
:vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType
:ivar translate_required_query_parameters_conduct: Strategy of translating required query
parameters to template ones. By default has value 'template'. Possible values: 'template',
@@ -1590,6 +1709,7 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
"display_name": {"max_length": 300, "min_length": 1},
"service_url": {"max_length": 2000},
"path": {"required": True, "max_length": 400},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -1617,6 +1737,7 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): # pylint: disable=too
"path": {"key": "path", "type": "str"},
"protocols": {"key": "protocols", "type": "[str]"},
"api_version_set": {"key": "apiVersionSet", "type": "ApiVersionSetContractDetails"},
+ "provisioning_state": {"key": "provisioningState", "type": "str"},
"value": {"key": "value", "type": "str"},
"format": {"key": "format", "type": "str"},
"wsdl_selector": {"key": "wsdlSelector", "type": "ApiCreateOrUpdatePropertiesWsdlSelector"},
@@ -1665,7 +1786,8 @@ def __init__( # pylint: disable=too-many-locals
:keyword subscription_key_parameter_names: Protocols over which API is made available.
:paramtype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
:paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:keyword api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -1707,9 +1829,10 @@ def __init__( # pylint: disable=too-many-locals
:paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails
:keyword value: Content value when Importing an API.
:paramtype value: str
- :keyword format: Format of the Content in which the API is getting imported. Known values are:
- "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", "wsdl-link",
- "openapi", "openapi+json", "openapi-link", "openapi+json-link", and "graphql-link".
+ :keyword format: Format of the Content in which the API is getting imported. New formats can be
+ added in the future. Known values are: "wadl-xml", "wadl-link-json", "swagger-json",
+ "swagger-link-json", "wsdl", "wsdl-link", "openapi", "openapi+json", "openapi-link",
+ "openapi+json-link", "graphql-link", "odata", "odata-link", "grpc", and "grpc-link".
:paramtype format: str or ~azure.mgmt.apimanagement.models.ContentFormat
:keyword wsdl_selector: Criteria to limit import of WSDL to a subset of the document.
:paramtype wsdl_selector:
@@ -1720,8 +1843,9 @@ def __init__( # pylint: disable=too-many-locals
* ``http`` creates a REST API
* ``soap`` creates a SOAP pass-through API
* ``websocket`` creates websocket API
- * ``graphql`` creates GraphQL API. Known values are: "http", "soap", "websocket", and
- "graphql".
+ * ``graphql`` creates GraphQL API.
+ New types can be added in the future. Known values are: "http", "soap", "websocket",
+ "graphql", "odata", and "grpc".
:paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType
:keyword translate_required_query_parameters_conduct: Strategy of translating required query
parameters to template ones. By default has value 'template'. Possible values: 'template',
@@ -2025,6 +2149,8 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:ivar virtual_network_configuration: Virtual network configuration of the API Management
service.
:vartype virtual_network_configuration:
@@ -2092,8 +2218,14 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
"""
_validation = {
@@ -2129,6 +2261,7 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab
"private_ip_addresses": {"key": "privateIPAddresses", "type": "[str]"},
"public_ip_address_id": {"key": "publicIpAddressId", "type": "str"},
"public_network_access": {"key": "publicNetworkAccess", "type": "str"},
+ "configuration_api": {"key": "configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {"key": "virtualNetworkConfiguration", "type": "VirtualNetworkConfiguration"},
"additional_locations": {"key": "additionalLocations", "type": "[AdditionalLocation]"},
"custom_properties": {"key": "customProperties", "type": "{str}"},
@@ -2145,6 +2278,8 @@ class ApiManagementServiceBaseProperties(_serialization.Model): # pylint: disab
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "developerPortalStatus", "type": "str"},
}
def __init__( # pylint: disable=too-many-locals
@@ -2154,6 +2289,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -2165,6 +2301,8 @@ def __init__( # pylint: disable=too-many-locals
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
**kwargs: Any
) -> None:
"""
@@ -2182,6 +2320,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -2245,6 +2385,13 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
"""
super().__init__(**kwargs)
self.notification_sender_email = notification_sender_email
@@ -2262,6 +2409,7 @@ def __init__( # pylint: disable=too-many-locals
self.private_ip_addresses = None
self.public_ip_address_id = public_ip_address_id
self.public_network_access = public_network_access
+ self.configuration_api = configuration_api
self.virtual_network_configuration = virtual_network_configuration
self.additional_locations = additional_locations
self.custom_properties = custom_properties
@@ -2275,6 +2423,8 @@ def __init__( # pylint: disable=too-many-locals
self.restore = restore
self.private_endpoint_connections = private_endpoint_connections
self.platform_version = None
+ self.legacy_portal_status = legacy_portal_status
+ self.developer_portal_status = developer_portal_status
class ApiManagementServiceCheckNameAvailabilityParameters(_serialization.Model):
@@ -2544,6 +2694,8 @@ class ApiManagementServiceProperties(
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:ivar virtual_network_configuration: Virtual network configuration of the API Management
service.
:vartype virtual_network_configuration:
@@ -2611,8 +2763,14 @@ class ApiManagementServiceProperties(
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
:ivar publisher_email: Publisher email. Required.
:vartype publisher_email: str
:ivar publisher_name: Publisher name. Required.
@@ -2654,6 +2812,7 @@ class ApiManagementServiceProperties(
"private_ip_addresses": {"key": "privateIPAddresses", "type": "[str]"},
"public_ip_address_id": {"key": "publicIpAddressId", "type": "str"},
"public_network_access": {"key": "publicNetworkAccess", "type": "str"},
+ "configuration_api": {"key": "configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {"key": "virtualNetworkConfiguration", "type": "VirtualNetworkConfiguration"},
"additional_locations": {"key": "additionalLocations", "type": "[AdditionalLocation]"},
"custom_properties": {"key": "customProperties", "type": "{str}"},
@@ -2670,6 +2829,8 @@ class ApiManagementServiceProperties(
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "developerPortalStatus", "type": "str"},
"publisher_email": {"key": "publisherEmail", "type": "str"},
"publisher_name": {"key": "publisherName", "type": "str"},
}
@@ -2683,6 +2844,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -2694,6 +2856,8 @@ def __init__( # pylint: disable=too-many-locals
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
**kwargs: Any
) -> None:
"""
@@ -2711,6 +2875,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -2774,6 +2940,13 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
:keyword publisher_email: Publisher email. Required.
:paramtype publisher_email: str
:keyword publisher_name: Publisher name. Required.
@@ -2784,6 +2957,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations=hostname_configurations,
public_ip_address_id=public_ip_address_id,
public_network_access=public_network_access,
+ configuration_api=configuration_api,
virtual_network_configuration=virtual_network_configuration,
additional_locations=additional_locations,
custom_properties=custom_properties,
@@ -2795,6 +2969,8 @@ def __init__( # pylint: disable=too-many-locals
api_version_constraint=api_version_constraint,
restore=restore,
private_endpoint_connections=private_endpoint_connections,
+ legacy_portal_status=legacy_portal_status,
+ developer_portal_status=developer_portal_status,
**kwargs
)
self.publisher_email = publisher_email
@@ -2910,6 +3086,8 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:ivar virtual_network_configuration: Virtual network configuration of the API Management
service.
:vartype virtual_network_configuration:
@@ -2977,8 +3155,14 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
:ivar publisher_email: Publisher email. Required.
:vartype publisher_email: str
:ivar publisher_name: Publisher name. Required.
@@ -3037,6 +3221,7 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in
"private_ip_addresses": {"key": "properties.privateIPAddresses", "type": "[str]"},
"public_ip_address_id": {"key": "properties.publicIpAddressId", "type": "str"},
"public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"},
+ "configuration_api": {"key": "properties.configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {
"key": "properties.virtualNetworkConfiguration",
"type": "VirtualNetworkConfiguration",
@@ -3056,6 +3241,8 @@ class ApiManagementServiceResource(ApimResource): # pylint: disable=too-many-in
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "properties.platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "properties.legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "properties.developerPortalStatus", "type": "str"},
"publisher_email": {"key": "properties.publisherEmail", "type": "str"},
"publisher_name": {"key": "properties.publisherName", "type": "str"},
}
@@ -3074,6 +3261,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -3085,6 +3273,8 @@ def __init__( # pylint: disable=too-many-locals
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
**kwargs: Any
) -> None:
"""
@@ -3112,6 +3302,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -3175,6 +3367,13 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
:keyword publisher_email: Publisher email. Required.
:paramtype publisher_email: str
:keyword publisher_name: Publisher name. Required.
@@ -3202,6 +3401,7 @@ def __init__( # pylint: disable=too-many-locals
self.private_ip_addresses = None
self.public_ip_address_id = public_ip_address_id
self.public_network_access = public_network_access
+ self.configuration_api = configuration_api
self.virtual_network_configuration = virtual_network_configuration
self.additional_locations = additional_locations
self.custom_properties = custom_properties
@@ -3215,6 +3415,8 @@ def __init__( # pylint: disable=too-many-locals
self.restore = restore
self.private_endpoint_connections = private_endpoint_connections
self.platform_version = None
+ self.legacy_portal_status = legacy_portal_status
+ self.developer_portal_status = developer_portal_status
self.publisher_email = publisher_email
self.publisher_name = publisher_name
@@ -3225,7 +3427,7 @@ class ApiManagementServiceSkuProperties(_serialization.Model):
All required parameters must be populated in order to send to Azure.
:ivar name: Name of the Sku. Required. Known values are: "Developer", "Standard", "Premium",
- "Basic", "Consumption", and "Isolated".
+ "Basic", "Consumption", "Isolated", "BasicV2", and "StandardV2".
:vartype name: str or ~azure.mgmt.apimanagement.models.SkuType
:ivar capacity: Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU
capacity must be specified as 0. Required.
@@ -3245,7 +3447,7 @@ class ApiManagementServiceSkuProperties(_serialization.Model):
def __init__(self, *, name: Union[str, "_models.SkuType"], capacity: int, **kwargs: Any) -> None:
"""
:keyword name: Name of the Sku. Required. Known values are: "Developer", "Standard", "Premium",
- "Basic", "Consumption", and "Isolated".
+ "Basic", "Consumption", "Isolated", "BasicV2", and "StandardV2".
:paramtype name: str or ~azure.mgmt.apimanagement.models.SkuType
:keyword capacity: Capacity of the SKU (number of deployed units of the SKU). For Consumption
SKU capacity must be specified as 0. Required.
@@ -3319,6 +3521,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:ivar virtual_network_configuration: Virtual network configuration of the API Management
service.
:vartype virtual_network_configuration:
@@ -3386,8 +3590,14 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
:ivar publisher_email: Publisher email.
:vartype publisher_email: str
:ivar publisher_name: Publisher name.
@@ -3441,6 +3651,7 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too
"private_ip_addresses": {"key": "properties.privateIPAddresses", "type": "[str]"},
"public_ip_address_id": {"key": "properties.publicIpAddressId", "type": "str"},
"public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"},
+ "configuration_api": {"key": "properties.configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {
"key": "properties.virtualNetworkConfiguration",
"type": "VirtualNetworkConfiguration",
@@ -3460,6 +3671,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): # pylint: disable=too
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "properties.platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "properties.legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "properties.developerPortalStatus", "type": "str"},
"publisher_email": {"key": "properties.publisherEmail", "type": "str"},
"publisher_name": {"key": "properties.publisherName", "type": "str"},
}
@@ -3475,6 +3688,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -3486,6 +3700,8 @@ def __init__( # pylint: disable=too-many-locals
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
publisher_email: Optional[str] = None,
publisher_name: Optional[str] = None,
**kwargs: Any
@@ -3513,6 +3729,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -3576,6 +3794,13 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
:keyword publisher_email: Publisher email.
:paramtype publisher_email: str
:keyword publisher_name: Publisher name.
@@ -3601,6 +3826,7 @@ def __init__( # pylint: disable=too-many-locals
self.private_ip_addresses = None
self.public_ip_address_id = public_ip_address_id
self.public_network_access = public_network_access
+ self.configuration_api = configuration_api
self.virtual_network_configuration = virtual_network_configuration
self.additional_locations = additional_locations
self.custom_properties = custom_properties
@@ -3614,6 +3840,8 @@ def __init__( # pylint: disable=too-many-locals
self.restore = restore
self.private_endpoint_connections = private_endpoint_connections
self.platform_version = None
+ self.legacy_portal_status = legacy_portal_status
+ self.developer_portal_status = developer_portal_status
self.publisher_email = publisher_email
self.publisher_name = publisher_name
@@ -3667,6 +3895,8 @@ class ApiManagementServiceUpdateProperties(
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :ivar configuration_api: Configuration API configuration of the API Management service.
+ :vartype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:ivar virtual_network_configuration: Virtual network configuration of the API Management
service.
:vartype virtual_network_configuration:
@@ -3734,8 +3964,14 @@ class ApiManagementServiceUpdateProperties(
:vartype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
:ivar platform_version: Compute Platform Version running the service in this location. Known
- values are: "undetermined", "stv1", "stv2", and "mtv1".
+ values are: "undetermined", "stv1", "stv2", "mtv1", and "stv2.1".
:vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion
+ :ivar legacy_portal_status: Status of legacy portal in the API Management service. Known values
+ are: "Enabled" and "Disabled".
+ :vartype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :ivar developer_portal_status: Status of developer portal in this API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :vartype developer_portal_status: str or ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
:ivar publisher_email: Publisher email.
:vartype publisher_email: str
:ivar publisher_name: Publisher name.
@@ -3777,6 +4013,7 @@ class ApiManagementServiceUpdateProperties(
"private_ip_addresses": {"key": "privateIPAddresses", "type": "[str]"},
"public_ip_address_id": {"key": "publicIpAddressId", "type": "str"},
"public_network_access": {"key": "publicNetworkAccess", "type": "str"},
+ "configuration_api": {"key": "configurationApi", "type": "ConfigurationApi"},
"virtual_network_configuration": {"key": "virtualNetworkConfiguration", "type": "VirtualNetworkConfiguration"},
"additional_locations": {"key": "additionalLocations", "type": "[AdditionalLocation]"},
"custom_properties": {"key": "customProperties", "type": "{str}"},
@@ -3793,6 +4030,8 @@ class ApiManagementServiceUpdateProperties(
"type": "[RemotePrivateEndpointConnectionWrapper]",
},
"platform_version": {"key": "platformVersion", "type": "str"},
+ "legacy_portal_status": {"key": "legacyPortalStatus", "type": "str"},
+ "developer_portal_status": {"key": "developerPortalStatus", "type": "str"},
"publisher_email": {"key": "publisherEmail", "type": "str"},
"publisher_name": {"key": "publisherName", "type": "str"},
}
@@ -3804,6 +4043,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations: Optional[List["_models.HostnameConfiguration"]] = None,
public_ip_address_id: Optional[str] = None,
public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None,
+ configuration_api: Optional["_models.ConfigurationApi"] = None,
virtual_network_configuration: Optional["_models.VirtualNetworkConfiguration"] = None,
additional_locations: Optional[List["_models.AdditionalLocation"]] = None,
custom_properties: Optional[Dict[str, str]] = None,
@@ -3815,6 +4055,8 @@ def __init__( # pylint: disable=too-many-locals
api_version_constraint: Optional["_models.ApiVersionConstraint"] = None,
restore: bool = False,
private_endpoint_connections: Optional[List["_models.RemotePrivateEndpointConnectionWrapper"]] = None,
+ legacy_portal_status: Union[str, "_models.LegacyPortalStatus"] = "Enabled",
+ developer_portal_status: Union[str, "_models.DeveloperPortalStatus"] = "Enabled",
publisher_email: Optional[str] = None,
publisher_name: Optional[str] = None,
**kwargs: Any
@@ -3834,6 +4076,8 @@ def __init__( # pylint: disable=too-many-locals
'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'.
Known values are: "Enabled" and "Disabled".
:paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess
+ :keyword configuration_api: Configuration API configuration of the API Management service.
+ :paramtype configuration_api: ~azure.mgmt.apimanagement.models.ConfigurationApi
:keyword virtual_network_configuration: Virtual network configuration of the API Management
service.
:paramtype virtual_network_configuration:
@@ -3897,6 +4141,13 @@ def __init__( # pylint: disable=too-many-locals
:keyword private_endpoint_connections: List of Private Endpoint Connections of this service.
:paramtype private_endpoint_connections:
list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper]
+ :keyword legacy_portal_status: Status of legacy portal in the API Management service. Known
+ values are: "Enabled" and "Disabled".
+ :paramtype legacy_portal_status: str or ~azure.mgmt.apimanagement.models.LegacyPortalStatus
+ :keyword developer_portal_status: Status of developer portal in this API Management service.
+ Known values are: "Enabled" and "Disabled".
+ :paramtype developer_portal_status: str or
+ ~azure.mgmt.apimanagement.models.DeveloperPortalStatus
:keyword publisher_email: Publisher email.
:paramtype publisher_email: str
:keyword publisher_name: Publisher name.
@@ -3907,6 +4158,7 @@ def __init__( # pylint: disable=too-many-locals
hostname_configurations=hostname_configurations,
public_ip_address_id=public_ip_address_id,
public_network_access=public_network_access,
+ configuration_api=configuration_api,
virtual_network_configuration=virtual_network_configuration,
additional_locations=additional_locations,
custom_properties=custom_properties,
@@ -3918,6 +4170,8 @@ def __init__( # pylint: disable=too-many-locals
api_version_constraint=api_version_constraint,
restore=restore,
private_endpoint_connections=private_endpoint_connections,
+ legacy_portal_status=legacy_portal_status,
+ developer_portal_status=developer_portal_status,
**kwargs
)
self.publisher_email = publisher_email
@@ -4526,7 +4780,8 @@ class ApiTagResourceContractProperties(ApiEntityBaseContract): # pylint: disabl
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
:vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:ivar api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -4637,7 +4892,8 @@ def __init__(
:keyword subscription_key_parameter_names: Protocols over which API is made available.
:paramtype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
:paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:keyword api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -4712,7 +4968,8 @@ class ApiUpdateContract(_serialization.Model): # pylint: disable=too-many-insta
:ivar subscription_key_parameter_names: Protocols over which API is made available.
:vartype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :ivar api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql", "odata",
+ and "grpc".
:vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:ivar api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -4822,7 +5079,8 @@ def __init__(
:keyword subscription_key_parameter_names: Protocols over which API is made available.
:paramtype subscription_key_parameter_names:
~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract
- :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", and "graphql".
+ :keyword api_type: Type of API. Known values are: "http", "soap", "websocket", "graphql",
+ "odata", and "grpc".
:paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType
:keyword api_revision: Describes the revision of the API. If no value is provided, default
revision 1 is created.
@@ -5513,6 +5771,8 @@ class AuthorizationAccessPolicyContract(ProxyResource):
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
+ :ivar app_ids: The allowed Azure Active Directory Application IDs.
+ :vartype app_ids: list[str]
:ivar tenant_id: The Tenant Id.
:vartype tenant_id: str
:ivar object_id: The Object Id.
@@ -5529,18 +5789,29 @@ class AuthorizationAccessPolicyContract(ProxyResource):
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
+ "app_ids": {"key": "properties.appIds", "type": "[str]"},
"tenant_id": {"key": "properties.tenantId", "type": "str"},
"object_id": {"key": "properties.objectId", "type": "str"},
}
- def __init__(self, *, tenant_id: Optional[str] = None, object_id: Optional[str] = None, **kwargs: Any) -> None:
+ def __init__(
+ self,
+ *,
+ app_ids: Optional[List[str]] = None,
+ tenant_id: Optional[str] = None,
+ object_id: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
"""
+ :keyword app_ids: The allowed Azure Active Directory Application IDs.
+ :paramtype app_ids: list[str]
:keyword tenant_id: The Tenant Id.
:paramtype tenant_id: str
:keyword object_id: The Object Id.
:paramtype object_id: str
"""
super().__init__(**kwargs)
+ self.app_ids = app_ids
self.tenant_id = tenant_id
self.object_id = object_id
@@ -7004,6 +7275,13 @@ class BackendBaseParameters(_serialization.Model):
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :vartype type: str or ~azure.mgmt.apimanagement.models.BackendType
"""
_validation = {
@@ -7020,6 +7298,9 @@ class BackendBaseParameters(_serialization.Model):
"credentials": {"key": "credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "proxy", "type": "BackendProxyContract"},
"tls": {"key": "tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "pool", "type": "BackendBaseParametersPool"},
+ "type": {"key": "type", "type": "str"},
}
def __init__(
@@ -7032,6 +7313,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type: Optional[Union[str, "_models.BackendType"]] = None,
**kwargs: Any
) -> None:
"""
@@ -7050,6 +7334,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :paramtype type: str or ~azure.mgmt.apimanagement.models.BackendType
"""
super().__init__(**kwargs)
self.title = title
@@ -7059,6 +7350,80 @@ def __init__(
self.credentials = credentials
self.proxy = proxy
self.tls = tls
+ self.circuit_breaker = circuit_breaker
+ self.pool = pool
+ self.type = type
+
+
+class BackendPool(_serialization.Model):
+ """Backend pool information.
+
+ :ivar services: The list of backend entities belonging to a pool.
+ :vartype services: list[~azure.mgmt.apimanagement.models.BackendPoolItem]
+ """
+
+ _validation = {
+ "services": {"min_items": 1},
+ }
+
+ _attribute_map = {
+ "services": {"key": "services", "type": "[BackendPoolItem]"},
+ }
+
+ def __init__(self, *, services: Optional[List["_models.BackendPoolItem"]] = None, **kwargs: Any) -> None:
+ """
+ :keyword services: The list of backend entities belonging to a pool.
+ :paramtype services: list[~azure.mgmt.apimanagement.models.BackendPoolItem]
+ """
+ super().__init__(**kwargs)
+ self.services = services
+
+
+class BackendBaseParametersPool(BackendPool):
+ """BackendBaseParametersPool.
+
+ :ivar services: The list of backend entities belonging to a pool.
+ :vartype services: list[~azure.mgmt.apimanagement.models.BackendPoolItem]
+ """
+
+ _validation = {
+ "services": {"min_items": 1},
+ }
+
+ _attribute_map = {
+ "services": {"key": "services", "type": "[BackendPoolItem]"},
+ }
+
+ def __init__(self, *, services: Optional[List["_models.BackendPoolItem"]] = None, **kwargs: Any) -> None:
+ """
+ :keyword services: The list of backend entities belonging to a pool.
+ :paramtype services: list[~azure.mgmt.apimanagement.models.BackendPoolItem]
+ """
+ super().__init__(services=services, **kwargs)
+
+
+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 +7493,13 @@ class BackendContract(ProxyResource): # pylint: disable=too-many-instance-attri
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type_properties_type: Type of the backend. A backend can be either Single or Pool. Known
+ values are: "Single" and "Pool".
+ :vartype type_properties_type: str or ~azure.mgmt.apimanagement.models.BackendType
:ivar url: Runtime Url of the Backend.
:vartype url: str
:ivar protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7155,6 +7527,9 @@ class BackendContract(ProxyResource): # pylint: disable=too-many-instance-attri
"credentials": {"key": "properties.credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "properties.proxy", "type": "BackendProxyContract"},
"tls": {"key": "properties.tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "properties.circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "properties.pool", "type": "BackendBaseParametersPool"},
+ "type_properties_type": {"key": "properties.type", "type": "str"},
"url": {"key": "properties.url", "type": "str"},
"protocol": {"key": "properties.protocol", "type": "str"},
}
@@ -7169,6 +7544,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type_properties_type: Optional[Union[str, "_models.BackendType"]] = None,
url: Optional[str] = None,
protocol: Optional[Union[str, "_models.BackendProtocol"]] = None,
**kwargs: Any
@@ -7189,6 +7567,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type_properties_type: Type of the backend. A backend can be either Single or Pool.
+ Known values are: "Single" and "Pool".
+ :paramtype type_properties_type: str or ~azure.mgmt.apimanagement.models.BackendType
:keyword url: Runtime Url of the Backend.
:paramtype url: str
:keyword protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7202,11 +7587,14 @@ def __init__(
self.credentials = credentials
self.proxy = proxy
self.tls = tls
+ self.circuit_breaker = circuit_breaker
+ self.pool = pool
+ self.type_properties_type = type_properties_type
self.url = url
self.protocol = protocol
-class BackendContractProperties(BackendBaseParameters):
+class BackendContractProperties(BackendBaseParameters): # pylint: disable=too-many-instance-attributes
"""Parameters supplied to the Create Backend operation.
All required parameters must be populated in order to send to Azure.
@@ -7226,6 +7614,13 @@ class BackendContractProperties(BackendBaseParameters):
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :vartype type: str or ~azure.mgmt.apimanagement.models.BackendType
:ivar url: Runtime Url of the Backend. Required.
:vartype url: str
:ivar protocol: Backend communication protocol. Required. Known values are: "http" and "soap".
@@ -7248,6 +7643,9 @@ class BackendContractProperties(BackendBaseParameters):
"credentials": {"key": "credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "proxy", "type": "BackendProxyContract"},
"tls": {"key": "tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "pool", "type": "BackendBaseParametersPool"},
+ "type": {"key": "type", "type": "str"},
"url": {"key": "url", "type": "str"},
"protocol": {"key": "protocol", "type": "str"},
}
@@ -7264,6 +7662,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type: Optional[Union[str, "_models.BackendType"]] = None,
**kwargs: Any
) -> None:
"""
@@ -7282,6 +7683,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :paramtype type: str or ~azure.mgmt.apimanagement.models.BackendType
:keyword url: Runtime Url of the Backend. Required.
:paramtype url: str
:keyword protocol: Backend communication protocol. Required. Known values are: "http" and
@@ -7296,6 +7704,9 @@ def __init__(
credentials=credentials,
proxy=proxy,
tls=tls,
+ circuit_breaker=circuit_breaker,
+ pool=pool,
+ type=type,
**kwargs
)
self.url = url
@@ -7363,6 +7774,34 @@ def __init__(
self.authorization = authorization
+class BackendPoolItem(_serialization.Model):
+ """Backend pool service information.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :ivar id: The unique ARM id of the backend entity. The ARM id should refer to an already
+ existing backend entity. Required.
+ :vartype id: str
+ """
+
+ _validation = {
+ "id": {"required": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ }
+
+ def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin
+ """
+ :keyword id: The unique ARM id of the backend entity. The ARM id should refer to an already
+ existing backend entity. Required.
+ :paramtype id: str
+ """
+ super().__init__(**kwargs)
+ self.id = id
+
+
class BackendProperties(_serialization.Model):
"""Properties specific to the Backend Type.
@@ -7574,7 +8013,7 @@ def __init__(
self.validate_certificate_name = validate_certificate_name
-class BackendUpdateParameterProperties(BackendBaseParameters):
+class BackendUpdateParameterProperties(BackendBaseParameters): # pylint: disable=too-many-instance-attributes
"""Parameters supplied to the Update Backend operation.
:ivar title: Backend Title.
@@ -7592,6 +8031,13 @@ class BackendUpdateParameterProperties(BackendBaseParameters):
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :vartype type: str or ~azure.mgmt.apimanagement.models.BackendType
:ivar url: Runtime Url of the Backend.
:vartype url: str
:ivar protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7613,6 +8059,9 @@ class BackendUpdateParameterProperties(BackendBaseParameters):
"credentials": {"key": "credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "proxy", "type": "BackendProxyContract"},
"tls": {"key": "tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "pool", "type": "BackendBaseParametersPool"},
+ "type": {"key": "type", "type": "str"},
"url": {"key": "url", "type": "str"},
"protocol": {"key": "protocol", "type": "str"},
}
@@ -7627,6 +8076,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type: Optional[Union[str, "_models.BackendType"]] = None,
url: Optional[str] = None,
protocol: Optional[Union[str, "_models.BackendProtocol"]] = None,
**kwargs: Any
@@ -7647,6 +8099,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :paramtype type: str or ~azure.mgmt.apimanagement.models.BackendType
:keyword url: Runtime Url of the Backend.
:paramtype url: str
:keyword protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7660,13 +8119,16 @@ def __init__(
credentials=credentials,
proxy=proxy,
tls=tls,
+ circuit_breaker=circuit_breaker,
+ pool=pool,
+ type=type,
**kwargs
)
self.url = url
self.protocol = protocol
-class BackendUpdateParameters(_serialization.Model):
+class BackendUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes
"""Backend update parameters.
:ivar title: Backend Title.
@@ -7684,6 +8146,13 @@ class BackendUpdateParameters(_serialization.Model):
:vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:ivar tls: Backend TLS Properties.
:vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :ivar circuit_breaker: Backend Circuit Breaker Configuration.
+ :vartype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :ivar pool:
+ :vartype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :ivar type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :vartype type: str or ~azure.mgmt.apimanagement.models.BackendType
:ivar url: Runtime Url of the Backend.
:vartype url: str
:ivar protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7705,6 +8174,9 @@ class BackendUpdateParameters(_serialization.Model):
"credentials": {"key": "properties.credentials", "type": "BackendCredentialsContract"},
"proxy": {"key": "properties.proxy", "type": "BackendProxyContract"},
"tls": {"key": "properties.tls", "type": "BackendTlsProperties"},
+ "circuit_breaker": {"key": "properties.circuitBreaker", "type": "BackendCircuitBreaker"},
+ "pool": {"key": "properties.pool", "type": "BackendBaseParametersPool"},
+ "type": {"key": "properties.type", "type": "str"},
"url": {"key": "properties.url", "type": "str"},
"protocol": {"key": "properties.protocol", "type": "str"},
}
@@ -7719,6 +8191,9 @@ def __init__(
credentials: Optional["_models.BackendCredentialsContract"] = None,
proxy: Optional["_models.BackendProxyContract"] = None,
tls: Optional["_models.BackendTlsProperties"] = None,
+ circuit_breaker: Optional["_models.BackendCircuitBreaker"] = None,
+ pool: Optional["_models.BackendBaseParametersPool"] = None,
+ type: Optional[Union[str, "_models.BackendType"]] = None,
url: Optional[str] = None,
protocol: Optional[Union[str, "_models.BackendProtocol"]] = None,
**kwargs: Any
@@ -7739,6 +8214,13 @@ def __init__(
:paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract
:keyword tls: Backend TLS Properties.
:paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties
+ :keyword circuit_breaker: Backend Circuit Breaker Configuration.
+ :paramtype circuit_breaker: ~azure.mgmt.apimanagement.models.BackendCircuitBreaker
+ :keyword pool:
+ :paramtype pool: ~azure.mgmt.apimanagement.models.BackendBaseParametersPool
+ :keyword type: Type of the backend. A backend can be either Single or Pool. Known values are:
+ "Single" and "Pool".
+ :paramtype type: str or ~azure.mgmt.apimanagement.models.BackendType
:keyword url: Runtime Url of the Backend.
:paramtype url: str
:keyword protocol: Backend communication protocol. Known values are: "http" and "soap".
@@ -7752,6 +8234,9 @@ def __init__(
self.credentials = credentials
self.proxy = proxy
self.tls = tls
+ self.circuit_breaker = circuit_breaker
+ self.pool = pool
+ self.type = type
self.url = url
self.protocol = protocol
@@ -8189,6 +8674,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.
@@ -8209,6 +8791,32 @@ def __init__(self, *, client_secret: Optional[str] = None, **kwargs: Any) -> Non
self.client_secret = client_secret
+class ConfigurationApi(_serialization.Model):
+ """Information regarding the Configuration API of the API Management service.
+
+ :ivar legacy_api: Indication whether or not the legacy Configuration API (v1) should be exposed
+ on the API Management service. Value is optional but must be 'Enabled' or 'Disabled'. If
+ 'Disabled', legacy Configuration API (v1) will not be available for self-hosted gateways.
+ Default value is 'Enabled'. Known values are: "Enabled" and "Disabled".
+ :vartype legacy_api: str or ~azure.mgmt.apimanagement.models.LegacyApiState
+ """
+
+ _attribute_map = {
+ "legacy_api": {"key": "legacyApi", "type": "str"},
+ }
+
+ def __init__(self, *, legacy_api: Union[str, "_models.LegacyApiState"] = "Enabled", **kwargs: Any) -> None:
+ """
+ :keyword legacy_api: Indication whether or not the legacy Configuration API (v1) should be
+ exposed on the API Management service. Value is optional but must be 'Enabled' or 'Disabled'.
+ If 'Disabled', legacy Configuration API (v1) will not be available for self-hosted gateways.
+ Default value is 'Enabled'. Known values are: "Enabled" and "Disabled".
+ :paramtype legacy_api: str or ~azure.mgmt.apimanagement.models.LegacyApiState
+ """
+ super().__init__(**kwargs)
+ self.legacy_api = legacy_api
+
+
class ConnectivityCheckRequest(_serialization.Model):
"""A request to perform the connectivity check operation on a API Management service.
@@ -9667,6 +10275,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.
@@ -9821,6 +10466,26 @@ def __init__(
self.description = description
+class GatewayDebugCredentialsContract(_serialization.Model):
+ """Gateway debug credentials.
+
+ :ivar token: Gateway debug token.
+ :vartype token: str
+ """
+
+ _attribute_map = {
+ "token": {"key": "token", "type": "str"},
+ }
+
+ def __init__(self, *, token: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword token: Gateway debug token.
+ :paramtype token: str
+ """
+ super().__init__(**kwargs)
+ self.token = token
+
+
class GatewayHostnameConfigurationCollection(_serialization.Model):
"""Paged Gateway hostname configuration list representation.
@@ -9984,18 +10649,88 @@ def __init__(self, *, primary: Optional[str] = None, secondary: Optional[str] =
self.secondary = secondary
-class GatewayTokenContract(_serialization.Model):
- """Gateway access token.
+class GatewayListDebugCredentialsContract(_serialization.Model):
+ """List debug credentials properties.
- :ivar value: Shared Access Authentication token value for the Gateway.
- :vartype value: str
+ All required parameters must be populated in order to send to Azure.
+
+ :ivar credentials_expire_after: Credentials expiration in ISO8601 format. Maximum duration of
+ the credentials is PT1H. When property is not specified, them value PT1H is used.
+ :vartype credentials_expire_after: ~datetime.timedelta
+ :ivar purposes: Purposes of debug credential. Required.
+ :vartype purposes: list[str or
+ ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContractPurpose]
+ :ivar api_id: Full resource Id of an API. Required.
+ :vartype api_id: str
"""
+ _validation = {
+ "purposes": {"required": True},
+ "api_id": {"required": True},
+ }
+
_attribute_map = {
- "value": {"key": "value", "type": "str"},
+ "credentials_expire_after": {"key": "credentialsExpireAfter", "type": "duration"},
+ "purposes": {"key": "purposes", "type": "[str]"},
+ "api_id": {"key": "apiId", "type": "str"},
}
- def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None:
+ def __init__(
+ self,
+ *,
+ purposes: List[Union[str, "_models.GatewayListDebugCredentialsContractPurpose"]],
+ api_id: str,
+ credentials_expire_after: Optional[datetime.timedelta] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword credentials_expire_after: Credentials expiration in ISO8601 format. Maximum duration
+ of the credentials is PT1H. When property is not specified, them value PT1H is used.
+ :paramtype credentials_expire_after: ~datetime.timedelta
+ :keyword purposes: Purposes of debug credential. Required.
+ :paramtype purposes: list[str or
+ ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContractPurpose]
+ :keyword api_id: Full resource Id of an API. Required.
+ :paramtype api_id: str
+ """
+ super().__init__(**kwargs)
+ self.credentials_expire_after = credentials_expire_after
+ self.purposes = purposes
+ self.api_id = api_id
+
+
+class GatewayListTraceContract(_serialization.Model):
+ """List trace properties.
+
+ :ivar trace_id: Trace id.
+ :vartype trace_id: str
+ """
+
+ _attribute_map = {
+ "trace_id": {"key": "traceId", "type": "str"},
+ }
+
+ def __init__(self, *, trace_id: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword trace_id: Trace id.
+ :paramtype trace_id: str
+ """
+ super().__init__(**kwargs)
+ self.trace_id = trace_id
+
+
+class GatewayTokenContract(_serialization.Model):
+ """Gateway access token.
+
+ :ivar value: Shared Access Authentication token value for the Gateway.
+ :vartype value: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "str"},
+ }
+
+ def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword value: Shared Access Authentication token value for the Gateway.
:paramtype value: str
@@ -10119,12 +10854,15 @@ class GlobalSchemaContract(ProxyResource):
:vartype value: any
:ivar document: Global Schema document object for json-based schema formats(e.g. json schema).
:vartype document: JSON
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -10135,6 +10873,7 @@ class GlobalSchemaContract(ProxyResource):
"description": {"key": "properties.description", "type": "str"},
"value": {"key": "properties.value", "type": "object"},
"document": {"key": "properties.document", "type": "object"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(
@@ -10162,6 +10901,7 @@ def __init__(
self.description = description
self.value = value
self.document = document
+ self.provisioning_state = None
class GroupCollection(_serialization.Model):
@@ -10460,7 +11200,7 @@ class HostnameConfiguration(_serialization.Model): # pylint: disable=too-many-i
All required parameters must be populated in order to send to Azure.
:ivar type: Hostname type. Required. Known values are: "Proxy", "Portal", "Management", "Scm",
- and "DeveloperPortal".
+ "DeveloperPortal", and "ConfigurationApi".
:vartype type: str or ~azure.mgmt.apimanagement.models.HostnameType
:ivar host_name: Hostname to configure on the Api Management service. Required.
:vartype host_name: str
@@ -10532,7 +11272,7 @@ def __init__(
) -> None:
"""
:keyword type: Hostname type. Required. Known values are: "Proxy", "Portal", "Management",
- "Scm", and "DeveloperPortal".
+ "Scm", "DeveloperPortal", and "ConfigurationApi".
:paramtype type: str or ~azure.mgmt.apimanagement.models.HostnameType
:keyword host_name: Hostname to configure on the Api Management service. Required.
:paramtype host_name: str
@@ -12406,6 +13146,28 @@ def __init__(
self.is_buffered = is_buffered
+class MigrateToStv2Contract(_serialization.Model):
+ """Describes an available API Management SKU.
+
+ :ivar mode: Mode of Migration to stv2. Default is PreserveIp. Known values are: "PreserveIp"
+ and "NewIP".
+ :vartype mode: str or ~azure.mgmt.apimanagement.models.MigrateToStv2Mode
+ """
+
+ _attribute_map = {
+ "mode": {"key": "mode", "type": "str"},
+ }
+
+ def __init__(self, *, mode: Optional[Union[str, "_models.MigrateToStv2Mode"]] = None, **kwargs: Any) -> None:
+ """
+ :keyword mode: Mode of Migration to stv2. Default is PreserveIp. Known values are: "PreserveIp"
+ and "NewIP".
+ :paramtype mode: str or ~azure.mgmt.apimanagement.models.MigrateToStv2Mode
+ """
+ super().__init__(**kwargs)
+ self.mode = mode
+
+
class NamedValueCollection(_serialization.Model):
"""Paged NamedValue list representation.
@@ -12472,6 +13234,8 @@ class NamedValueContract(ProxyResource):
:vartype value: str
:ivar key_vault: KeyVault location details of the namedValue.
:vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
@@ -12481,6 +13245,7 @@ class NamedValueContract(ProxyResource):
"tags": {"max_items": 32, "min_items": 0},
"display_name": {"max_length": 256, "min_length": 1, "pattern": r"^[A-Za-z0-9-._]+$"},
"value": {"max_length": 4096},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -12492,6 +13257,7 @@ class NamedValueContract(ProxyResource):
"display_name": {"key": "properties.displayName", "type": "str"},
"value": {"key": "properties.value", "type": "str"},
"key_vault": {"key": "properties.keyVault", "type": "KeyVaultContractProperties"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(
@@ -12526,6 +13292,7 @@ def __init__(
self.display_name = display_name
self.value = value
self.key_vault = key_vault
+ self.provisioning_state = None
class NamedValueEntityBaseParameters(_serialization.Model):
@@ -12563,6 +13330,8 @@ def __init__(self, *, tags: Optional[List[str]] = None, secret: Optional[bool] =
class NamedValueContractProperties(NamedValueEntityBaseParameters):
"""NamedValue Contract properties.
+ Variables are only populated by the server, and will be ignored when sending a request.
+
All required parameters must be populated in order to send to Azure.
:ivar tags: Optional tags that when provided can be used to filter the NamedValue list.
@@ -12579,12 +13348,15 @@ class NamedValueContractProperties(NamedValueEntityBaseParameters):
:vartype value: str
:ivar key_vault: KeyVault location details of the namedValue.
:vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
"tags": {"max_items": 32, "min_items": 0},
"display_name": {"required": True, "max_length": 256, "min_length": 1, "pattern": r"^[A-Za-z0-9-._]+$"},
"value": {"max_length": 4096},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -12593,6 +13365,7 @@ class NamedValueContractProperties(NamedValueEntityBaseParameters):
"display_name": {"key": "displayName", "type": "str"},
"value": {"key": "value", "type": "str"},
"key_vault": {"key": "keyVault", "type": "KeyVaultContractProperties"},
+ "provisioning_state": {"key": "provisioningState", "type": "str"},
}
def __init__(
@@ -12625,6 +13398,7 @@ def __init__(
self.display_name = display_name
self.value = value
self.key_vault = key_vault
+ self.provisioning_state = None
class NamedValueCreateContract(ProxyResource):
@@ -14584,6 +15358,8 @@ class PolicyFragmentContract(ProxyResource):
:vartype description: str
:ivar format: Format of the policy fragment content. Known values are: "xml" and "rawxml".
:vartype format: str or ~azure.mgmt.apimanagement.models.PolicyFragmentContentFormat
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
@@ -14591,6 +15367,7 @@ class PolicyFragmentContract(ProxyResource):
"name": {"readonly": True},
"type": {"readonly": True},
"description": {"max_length": 1000},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -14600,6 +15377,7 @@ class PolicyFragmentContract(ProxyResource):
"value": {"key": "properties.value", "type": "str"},
"description": {"key": "properties.description", "type": "str"},
"format": {"key": "properties.format", "type": "str"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(
@@ -14622,6 +15400,211 @@ def __init__(
self.value = value
self.description = description
self.format = format
+ self.provisioning_state = None
+
+
+class PolicyRestrictionCollection(_serialization.Model):
+ """The response of the get policy restrictions operation.
+
+ :ivar value:
+ :vartype value: list[~azure.mgmt.apimanagement.models.PolicyRestrictionContract]
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[PolicyRestrictionContract]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.PolicyRestrictionContract"]] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value:
+ :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyRestrictionContract]
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.next_link = next_link
+
+
+class PolicyRestrictionContract(ProxyResource):
+ """Policy restriction contract details.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar id: Fully qualified resource ID for the resource. Ex -
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ :vartype id: str
+ :ivar name: The name of the resource.
+ :vartype name: str
+ :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
+ "Microsoft.Storage/storageAccounts".
+ :vartype type: str
+ :ivar scope: Path to the policy document.
+ :vartype scope: str
+ :ivar require_base: Indicates if base policy should be enforced for the policy document. Known
+ values are: "true" and "false".
+ :vartype require_base: str or ~azure.mgmt.apimanagement.models.PolicyRestrictionRequireBase
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ "scope": {"key": "properties.scope", "type": "str"},
+ "require_base": {"key": "properties.requireBase", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ scope: Optional[str] = None,
+ require_base: Union[str, "_models.PolicyRestrictionRequireBase"] = "false",
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword scope: Path to the policy document.
+ :paramtype scope: str
+ :keyword require_base: Indicates if base policy should be enforced for the policy document.
+ Known values are: "true" and "false".
+ :paramtype require_base: str or ~azure.mgmt.apimanagement.models.PolicyRestrictionRequireBase
+ """
+ super().__init__(**kwargs)
+ self.scope = scope
+ self.require_base = require_base
+
+
+class PolicyRestrictionUpdateContract(_serialization.Model):
+ """Policy restriction contract details.
+
+ :ivar scope: Path to the policy document.
+ :vartype scope: str
+ :ivar require_base: Indicates if base policy should be enforced for the policy document. Known
+ values are: "true" and "false".
+ :vartype require_base: str or ~azure.mgmt.apimanagement.models.PolicyRestrictionRequireBase
+ """
+
+ _attribute_map = {
+ "scope": {"key": "properties.scope", "type": "str"},
+ "require_base": {"key": "properties.requireBase", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ scope: Optional[str] = None,
+ require_base: Union[str, "_models.PolicyRestrictionRequireBase"] = "false",
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword scope: Path to the policy document.
+ :paramtype scope: str
+ :keyword require_base: Indicates if base policy should be enforced for the policy document.
+ Known values are: "true" and "false".
+ :paramtype require_base: str or ~azure.mgmt.apimanagement.models.PolicyRestrictionRequireBase
+ """
+ super().__init__(**kwargs)
+ self.scope = scope
+ self.require_base = require_base
+
+
+class PolicyWithComplianceCollection(_serialization.Model):
+ """The response of the list policy operation.
+
+ :ivar value: Policy Contract value.
+ :vartype value: list[~azure.mgmt.apimanagement.models.PolicyWithComplianceContract]
+ :ivar next_link: Next page link if any.
+ :vartype next_link: str
+ """
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[PolicyWithComplianceContract]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.PolicyWithComplianceContract"]] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Policy Contract value.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyWithComplianceContract]
+ :keyword next_link: Next page link if any.
+ :paramtype next_link: str
+ """
+ super().__init__(**kwargs)
+ self.value = value
+ self.next_link = next_link
+
+
+class PolicyWithComplianceContract(ProxyResource):
+ """Policy Contract details.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar id: Fully qualified resource ID for the resource. Ex -
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ :vartype id: str
+ :ivar name: The name of the resource.
+ :vartype name: str
+ :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
+ "Microsoft.Storage/storageAccounts".
+ :vartype type: str
+ :ivar reference_policy_id: Policy Identifier.
+ :vartype reference_policy_id: str
+ :ivar compliance_state: Policy Restriction Compliance State. Known values are: "Pending",
+ "NonCompliant", and "Compliant".
+ :vartype compliance_state: str or ~azure.mgmt.apimanagement.models.PolicyComplianceState
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ "reference_policy_id": {"key": "properties.referencePolicyId", "type": "str"},
+ "compliance_state": {"key": "properties.complianceState", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ reference_policy_id: Optional[str] = None,
+ compliance_state: Optional[Union[str, "_models.PolicyComplianceState"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword reference_policy_id: Policy Identifier.
+ :paramtype reference_policy_id: str
+ :keyword compliance_state: Policy Restriction Compliance State. Known values are: "Pending",
+ "NonCompliant", and "Compliant".
+ :paramtype compliance_state: str or ~azure.mgmt.apimanagement.models.PolicyComplianceState
+ """
+ super().__init__(**kwargs)
+ self.reference_policy_id = reference_policy_id
+ self.compliance_state = compliance_state
class PortalConfigCollection(_serialization.Model):
@@ -15039,6 +16022,8 @@ class PortalRevisionContract(ProxyResource):
:vartype created_date_time: ~datetime.datetime
:ivar updated_date_time: Last updated date and time.
:vartype updated_date_time: ~datetime.datetime
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
"""
_validation = {
@@ -15050,6 +16035,7 @@ class PortalRevisionContract(ProxyResource):
"status": {"readonly": True},
"created_date_time": {"readonly": True},
"updated_date_time": {"readonly": True},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -15062,6 +16048,7 @@ class PortalRevisionContract(ProxyResource):
"is_current": {"key": "properties.isCurrent", "type": "bool"},
"created_date_time": {"key": "properties.createdDateTime", "type": "iso-8601"},
"updated_date_time": {"key": "properties.updatedDateTime", "type": "iso-8601"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(self, *, description: Optional[str] = None, is_current: Optional[bool] = None, **kwargs: Any) -> None:
@@ -15078,6 +16065,7 @@ def __init__(self, *, description: Optional[str] = None, is_current: Optional[bo
self.is_current = is_current
self.created_date_time = None
self.updated_date_time = None
+ self.provisioning_state = None
class PortalSettingsCollection(_serialization.Model):
@@ -15595,11 +16583,11 @@ def __init__(
self.actions_required = actions_required
-class ProductCollection(_serialization.Model):
- """Paged Products list representation.
+class ProductApiLinkCollection(_serialization.Model):
+ """Paged Product-API link list representation.
:ivar value: Page values.
- :vartype value: list[~azure.mgmt.apimanagement.models.ProductContract]
+ :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.
@@ -15607,7 +16595,7 @@ class ProductCollection(_serialization.Model):
"""
_attribute_map = {
- "value": {"key": "value", "type": "[ProductContract]"},
+ "value": {"key": "value", "type": "[ProductApiLinkContract]"},
"count": {"key": "count", "type": "int"},
"next_link": {"key": "nextLink", "type": "str"},
}
@@ -15615,14 +16603,14 @@ class ProductCollection(_serialization.Model):
def __init__(
self,
*,
- value: Optional[List["_models.ProductContract"]] = None,
+ 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.ProductContract]
+ :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.
@@ -15634,8 +16622,8 @@ def __init__(
self.next_link = next_link
-class ProductContract(ProxyResource):
- """Product details.
+class ProductApiLinkContract(ProxyResource):
+ """Product-API link details.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -15647,34 +16635,112 @@ class ProductContract(ProxyResource):
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
"Microsoft.Storage/storageAccounts".
:vartype type: str
- :ivar description: Product description. May include HTML formatting tags.
- :vartype description: str
- :ivar terms: Product terms of use. Developers trying to subscribe to the product will be
- presented and required to accept these terms before they can complete the subscription process.
- :vartype terms: str
- :ivar subscription_required: Whether a product subscription is required for accessing APIs
- included in this product. If true, the product is referred to as "protected" and a valid
- subscription key is required for a request to an API included in the product to succeed. If
- false, the product is referred to as "open" and requests to an API included in the product can
- be made without a subscription key. If property is omitted when creating a new product it's
- value is assumed to be true.
- :vartype subscription_required: bool
- :ivar approval_required: whether subscription approval is required. If false, new subscriptions
- will be approved automatically enabling developers to call the product’s APIs immediately after
- subscribing. If true, administrators must manually approve the subscription before the
- developer can any of the product’s APIs. Can be present only if subscriptionRequired property
- is present and has a value of false.
- :vartype approval_required: bool
- :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product
- at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present
- only if subscriptionRequired property is present and has a value of false.
- :vartype subscriptions_limit: int
- :ivar state: whether product is published or not. Published products are discoverable by users
- of developer portal. Non published products are visible only to administrators. Default state
- of Product is notPublished. Known values are: "notPublished" and "published".
- :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState
- :ivar display_name: Product name.
- :vartype display_name: 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.
+
+ :ivar value: Page values.
+ :vartype value: list[~azure.mgmt.apimanagement.models.ProductContract]
+ :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": "[ProductContract]"},
+ "count": {"key": "count", "type": "int"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: Optional[List["_models.ProductContract"]] = None,
+ count: Optional[int] = None,
+ next_link: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword value: Page values.
+ :paramtype value: list[~azure.mgmt.apimanagement.models.ProductContract]
+ :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 ProductContract(ProxyResource):
+ """Product 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 description: Product description. May include HTML formatting tags.
+ :vartype description: str
+ :ivar terms: Product terms of use. Developers trying to subscribe to the product will be
+ presented and required to accept these terms before they can complete the subscription process.
+ :vartype terms: str
+ :ivar subscription_required: Whether a product subscription is required for accessing APIs
+ included in this product. If true, the product is referred to as "protected" and a valid
+ subscription key is required for a request to an API included in the product to succeed. If
+ false, the product is referred to as "open" and requests to an API included in the product can
+ be made without a subscription key. If property is omitted when creating a new product it's
+ value is assumed to be true.
+ :vartype subscription_required: bool
+ :ivar approval_required: whether subscription approval is required. If false, new subscriptions
+ will be approved automatically enabling developers to call the product’s APIs immediately after
+ subscribing. If true, administrators must manually approve the subscription before the
+ developer can any of the product’s APIs. Can be present only if subscriptionRequired property
+ is present and has a value of false.
+ :vartype approval_required: bool
+ :ivar subscriptions_limit: Whether the number of subscriptions a user can have to this product
+ at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present
+ only if subscriptionRequired property is present and has a value of false.
+ :vartype subscriptions_limit: int
+ :ivar state: whether product is published or not. Published products are discoverable by users
+ of developer portal. Non published products are visible only to administrators. Default state
+ of Product is notPublished. Known values are: "notPublished" and "published".
+ :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState
+ :ivar display_name: Product name.
+ :vartype display_name: str
"""
_validation = {
@@ -15946,6 +17012,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.
@@ -17766,7 +18910,7 @@ class ResourceSku(_serialization.Model):
"""Describes an available API Management SKU.
:ivar name: Name of the Sku. Known values are: "Developer", "Standard", "Premium", "Basic",
- "Consumption", and "Isolated".
+ "Consumption", "Isolated", "BasicV2", and "StandardV2".
:vartype name: str or ~azure.mgmt.apimanagement.models.SkuType
"""
@@ -17777,7 +18921,7 @@ class ResourceSku(_serialization.Model):
def __init__(self, *, name: Optional[Union[str, "_models.SkuType"]] = None, **kwargs: Any) -> None:
"""
:keyword name: Name of the Sku. Known values are: "Developer", "Standard", "Premium", "Basic",
- "Consumption", and "Isolated".
+ "Consumption", "Isolated", "BasicV2", and "StandardV2".
:paramtype name: str or ~azure.mgmt.apimanagement.models.SkuType
"""
super().__init__(**kwargs)
@@ -18060,8 +19204,11 @@ class SchemaContract(ProxyResource):
- ``Swagger`` Schema use ``application/vnd.ms-azure-apim.swagger.definitions+json`` -
``WSDL`` Schema use ``application/vnd.ms-azure-apim.xsd+xml`` - ``OpenApi`` Schema use
``application/vnd.oai.openapi.components+json`` - ``WADL Schema`` use
- ``application/vnd.ms-azure-apim.wadl.grammars+xml``.
+ ``application/vnd.ms-azure-apim.wadl.grammars+xml`` - ``OData Schema`` use
+ ``application/vnd.ms-azure-apim.odata.schema`` - ``gRPC Schema`` use ``text/protobuf``.
:vartype content_type: str
+ :ivar provisioning_state: The provisioning state.
+ :vartype provisioning_state: str
:ivar value: Json escaped string defining the document representing the Schema. Used for
schemas other than Swagger/OpenAPI.
:vartype value: str
@@ -18076,6 +19223,7 @@ class SchemaContract(ProxyResource):
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
+ "provisioning_state": {"readonly": True},
}
_attribute_map = {
@@ -18083,6 +19231,7 @@ class SchemaContract(ProxyResource):
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"content_type": {"key": "properties.contentType", "type": "str"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"value": {"key": "properties.document.value", "type": "str"},
"definitions": {"key": "properties.document.definitions", "type": "object"},
"components": {"key": "properties.document.components", "type": "object"},
@@ -18103,7 +19252,8 @@ def __init__(
- ``Swagger`` Schema use ``application/vnd.ms-azure-apim.swagger.definitions+json`` -
``WSDL`` Schema use ``application/vnd.ms-azure-apim.xsd+xml`` - ``OpenApi`` Schema use
``application/vnd.oai.openapi.components+json`` - ``WADL Schema`` use
- ``application/vnd.ms-azure-apim.wadl.grammars+xml``.
+ ``application/vnd.ms-azure-apim.wadl.grammars+xml`` - ``OData Schema`` use
+ ``application/vnd.ms-azure-apim.odata.schema`` - ``gRPC Schema`` use ``text/protobuf``.
:paramtype content_type: str
:keyword value: Json escaped string defining the document representing the Schema. Used for
schemas other than Swagger/OpenAPI.
@@ -18117,6 +19267,7 @@ def __init__(
"""
super().__init__(**kwargs)
self.content_type = content_type
+ self.provisioning_state = None
self.value = value
self.definitions = definitions
self.components = components
@@ -18674,6 +19825,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 +20265,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 +21693,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..58529f302fd4 100644
--- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py
@@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from ._all_policies_operations import AllPoliciesOperations
from ._api_operations import ApiOperations
from ._api_revision_operations import ApiRevisionOperations
from ._api_release_operations import ApiReleaseOperations
@@ -27,11 +28,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 +44,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
@@ -63,6 +65,8 @@
from ._policy_operations import PolicyOperations
from ._policy_description_operations import PolicyDescriptionOperations
from ._policy_fragment_operations import PolicyFragmentOperations
+from ._policy_restriction_operations import PolicyRestrictionOperations
+from ._policy_restriction_validations_operations import PolicyRestrictionValidationsOperations
from ._portal_config_operations import PortalConfigOperations
from ._portal_revision_operations import PortalRevisionOperations
from ._portal_settings_operations import PortalSettingsOperations
@@ -77,6 +81,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 +92,9 @@
from ._api_management_skus_operations import ApiManagementSkusOperations
from ._subscription_operations import SubscriptionOperations
from ._tag_resource_operations import TagResourceOperations
+from ._tag_api_link_operations import TagApiLinkOperations
+from ._tag_operation_link_operations import TagOperationLinkOperations
+from ._tag_product_link_operations import TagProductLinkOperations
from ._tenant_access_operations import TenantAccessOperations
from ._tenant_access_git_operations import TenantAccessGitOperations
from ._tenant_configuration_operations import TenantConfigurationOperations
@@ -94,13 +103,41 @@
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
from ._patch import patch_sdk as _patch_sdk
__all__ = [
+ "AllPoliciesOperations",
"ApiOperations",
"ApiRevisionOperations",
"ApiReleaseOperations",
@@ -122,11 +159,11 @@
"ApiWikisOperations",
"ApiExportOperations",
"ApiVersionSetOperations",
- "AuthorizationServerOperations",
"AuthorizationProviderOperations",
"AuthorizationOperations",
"AuthorizationLoginLinksOperations",
"AuthorizationAccessPolicyOperations",
+ "AuthorizationServerOperations",
"BackendOperations",
"CacheOperations",
"CertificateOperations",
@@ -138,6 +175,7 @@
"ApiManagementServiceSkusOperations",
"ApiManagementServiceOperations",
"DiagnosticOperations",
+ "DocumentationOperations",
"EmailTemplateOperations",
"GatewayOperations",
"GatewayHostnameConfigurationOperations",
@@ -158,6 +196,8 @@
"PolicyOperations",
"PolicyDescriptionOperations",
"PolicyFragmentOperations",
+ "PolicyRestrictionOperations",
+ "PolicyRestrictionValidationsOperations",
"PortalConfigOperations",
"PortalRevisionOperations",
"PortalSettingsOperations",
@@ -172,6 +212,8 @@
"ProductPolicyOperations",
"ProductWikiOperations",
"ProductWikisOperations",
+ "ProductApiLinkOperations",
+ "ProductGroupLinkOperations",
"QuotaByCounterKeysOperations",
"QuotaByPeriodKeysOperations",
"RegionOperations",
@@ -181,6 +223,9 @@
"ApiManagementSkusOperations",
"SubscriptionOperations",
"TagResourceOperations",
+ "TagApiLinkOperations",
+ "TagOperationLinkOperations",
+ "TagProductLinkOperations",
"TenantAccessOperations",
"TenantAccessGitOperations",
"TenantConfigurationOperations",
@@ -189,7 +234,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/_all_policies_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_all_policies_operations.py
new file mode 100644
index 000000000000..3304c4010758
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_all_policies_operations.py
@@ -0,0 +1,188 @@
+# 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
+
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/allPolicies",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class AllPoliciesOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`all_policies` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> Iterable["_models.AllPoliciesContract"]:
+ """Status of all policies of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: An iterator like instance of either AllPoliciesContract or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.AllPoliciesContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.AllPoliciesCollection] = kwargs.pop("cls", None)
+
+ error_map = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ request = build_list_by_service_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ 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("AllPoliciesCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ return pipeline_response
+
+ return ItemPaged(get_next, extract_data)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/allPolicies"
+ }
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..8e569aa1e805 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -97,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -121,10 +122,10 @@ def build_get_entity_tag_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -141,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -165,10 +166,10 @@ def build_get_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -192,7 +193,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -217,10 +218,10 @@ def build_create_or_update_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -248,7 +249,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -273,10 +274,10 @@ def build_update_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -303,7 +304,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -327,10 +328,10 @@ def build_delete_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -761,7 +762,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DiagnosticContract")
@@ -952,7 +953,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DiagnosticContract")
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..6e0c4f4919f4 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
@@ -25,7 +25,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -68,10 +68,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["format"] = _SERIALIZER.query("format", format, "str")
@@ -125,8 +125,8 @@ def get(
instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
:type api_id: str
:param format: Format in which to export the Api Details to the Storage Blob with Sas Key valid
- for 5 minutes. Known values are: "swagger-link", "wsdl-link", "wadl-link", "openapi-link", and
- "openapi+json-link". Required.
+ for 5 minutes. New formats can be added in the future. Known values are: "swagger-link",
+ "wsdl-link", "wadl-link", "openapi-link", and "openapi+json-link". Required.
:type format: str or ~azure.mgmt.apimanagement.models.ExportFormat
:param export: Query parameter required to export the API details. "true" Required.
:type export: str or ~azure.mgmt.apimanagement.models.ExportApi
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..ead04223ae4a 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -75,10 +76,10 @@ def build_list_by_service_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -107,7 +108,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -134,10 +135,10 @@ def build_get_entity_tag_request(
"attachmentId": _SERIALIZER.url(
"attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -160,7 +161,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -187,10 +188,10 @@ def build_get_request(
"attachmentId": _SERIALIZER.url(
"attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -215,7 +216,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -243,10 +244,10 @@ def build_create_or_update_request(
"attachmentId": _SERIALIZER.url(
"attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -275,7 +276,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -302,10 +303,10 @@ def build_delete_request(
"attachmentId": _SERIALIZER.url(
"attachment_id", attachment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -764,7 +765,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IssueAttachmentContract")
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..fd813abb3270 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -75,10 +76,10 @@ def build_list_by_service_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -107,7 +108,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -134,10 +135,10 @@ def build_get_entity_tag_request(
"commentId": _SERIALIZER.url(
"comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -160,7 +161,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -187,10 +188,10 @@ def build_get_request(
"commentId": _SERIALIZER.url(
"comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -215,7 +216,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -243,10 +244,10 @@ def build_create_or_update_request(
"commentId": _SERIALIZER.url(
"comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -275,7 +276,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -302,10 +303,10 @@ def build_delete_request(
"commentId": _SERIALIZER.url(
"comment_id", comment_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -764,7 +765,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IssueCommentContract")
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..ceb6ad7b8abd 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,10 +73,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -102,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -126,10 +127,10 @@ def build_get_entity_tag_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -153,7 +154,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -177,10 +178,10 @@ def build_get_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if expand_comments_attachments is not None:
@@ -208,7 +209,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -233,10 +234,10 @@ def build_create_or_update_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -264,7 +265,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -289,10 +290,10 @@ def build_update_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -319,7 +320,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -343,10 +344,10 @@ def build_delete_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -790,7 +791,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IssueContract")
@@ -981,7 +982,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IssueUpdateContract")
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..9789b3b187c6 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
from azure.core.exceptions import (
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -36,13 +37,13 @@
_SERIALIZER.client_side_validation = False
-def build_perform_connectivity_check_async_request( # pylint: disable=name-too-long
+def build_perform_connectivity_check_async_request(
resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -63,10 +64,10 @@ def build_perform_connectivity_check_async_request( # pylint: disable=name-too-
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -80,7 +81,7 @@ def build_perform_connectivity_check_async_request( # pylint: disable=name-too-
class ApiManagementClientOperationsMixin(ApiManagementClientMixinABC):
- def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long
+ def _perform_connectivity_check_async_initial(
self,
resource_group_name: str,
service_name: str,
@@ -105,7 +106,7 @@ def _perform_connectivity_check_async_initial( # pylint: disable=name-too-long
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(connectivity_check_request_params, (IO, bytes)):
+ if isinstance(connectivity_check_request_params, (IOBase, bytes)):
_content = connectivity_check_request_params
else:
_json = self._serialize.body(connectivity_check_request_params, "ConnectivityCheckRequest")
@@ -138,11 +139,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..5c36849353e9 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", "2023-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..e983f3ec887a 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -29,7 +30,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -44,7 +45,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -65,10 +66,10 @@ def build_restore_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -87,7 +88,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -108,10 +109,10 @@ def build_backup_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -130,7 +131,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -151,10 +152,10 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -173,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -194,10 +195,10 @@ def build_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -214,7 +215,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -234,10 +235,10 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -254,7 +255,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -274,10 +275,10 @@ def build_delete_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -294,7 +295,8 @@ def build_migrate_to_stv2_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -314,15 +316,17 @@ def build_migrate_to_stv2_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
@@ -332,7 +336,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -344,10 +348,10 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -362,16 +366,16 @@ 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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service")
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -388,7 +392,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -408,10 +412,10 @@ def build_get_sso_token_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -426,7 +430,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -435,10 +439,10 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability"
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -451,13 +455,11 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-def build_get_domain_ownership_identifier_request( # pylint: disable=name-too-long
- subscription_id: str, **kwargs: Any
-) -> HttpRequest:
+def build_get_domain_ownership_identifier_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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -465,10 +467,10 @@ def build_get_domain_ownership_identifier_request( # pylint: disable=name-too-l
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier"
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -479,13 +481,13 @@ def build_get_domain_ownership_identifier_request( # pylint: disable=name-too-l
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-def build_apply_network_configuration_updates_request( # pylint: disable=name-too-long
+def build_apply_network_configuration_updates_request(
resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -506,10 +508,10 @@ def build_apply_network_configuration_updates_request( # pylint: disable=name-t
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -566,7 +568,7 @@ def _restore_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceBackupRestoreParameters")
@@ -808,7 +810,7 @@ def _backup_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceBackupRestoreParameters")
@@ -846,7 +848,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)
@@ -1045,7 +1047,7 @@ def _create_or_update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceResource")
@@ -1279,7 +1281,7 @@ def _update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceUpdateParameters")
@@ -1312,11 +1314,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 +1594,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 +1655,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:
@@ -1671,7 +1684,11 @@ def get_long_running_output(pipeline_response):
}
def _migrate_to_stv2_initial(
- self, resource_group_name: str, service_name: str, **kwargs: Any
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[Union[_models.MigrateToStv2Contract, IO]] = None,
+ **kwargs: Any
) -> Optional[_models.ApiManagementServiceResource]:
error_map = {
401: ClientAuthenticationError,
@@ -1681,17 +1698,32 @@ def _migrate_to_stv2_initial(
}
error_map.update(kwargs.pop("error_map", {}) or {})
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.ApiManagementServiceResource]] = kwargs.pop("cls", None)
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ if parameters is not None:
+ _json = self._serialize.body(parameters, "MigrateToStv2Contract")
+ else:
+ _json = None
+
request = build_migrate_to_stv2_request(
resource_group_name=resource_group_name,
service_name=service_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
template_url=self._migrate_to_stv2_initial.metadata["url"],
headers=_headers,
params=_params,
@@ -1728,9 +1760,91 @@ def _migrate_to_stv2_initial(
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2"
}
+ @overload
+ def begin_migrate_to_stv2(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[_models.MigrateToStv2Contract] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementServiceResource]:
+ """Upgrades an API Management service to the Stv2 platform. For details refer to
+ https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Default value is None.
+ :type parameters: ~azure.mgmt.apimanagement.models.MigrateToStv2Contract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :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 ApiManagementServiceResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def begin_migrate_to_stv2(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[IO] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.ApiManagementServiceResource]:
+ """Upgrades an API Management service to the Stv2 platform. For details refer to
+ https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
+ and could take several minutes to complete.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Default value is None.
+ :type parameters: IO
+ :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 ApiManagementServiceResource or the
+ result of cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
@distributed_trace
def begin_migrate_to_stv2(
- self, resource_group_name: str, service_name: str, **kwargs: Any
+ self,
+ resource_group_name: str,
+ service_name: str,
+ parameters: Optional[Union[_models.MigrateToStv2Contract, IO]] = None,
+ **kwargs: Any
) -> LROPoller[_models.ApiManagementServiceResource]:
"""Upgrades an API Management service to the Stv2 platform. For details refer to
https://aka.ms/apim-migrate-stv2. This change is not reversible. This is long running operation
@@ -1741,6 +1855,12 @@ def begin_migrate_to_stv2(
:type resource_group_name: str
:param service_name: The name of the API Management service. Required.
:type service_name: str
+ :param parameters: Optional parameters supplied to migrate service. Is either a
+ MigrateToStv2Contract type or a IO type. Default value is None.
+ :type parameters: ~azure.mgmt.apimanagement.models.MigrateToStv2Contract 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
@@ -1755,10 +1875,11 @@ def begin_migrate_to_stv2(
~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
- _headers = kwargs.pop("headers", {}) or {}
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiManagementServiceResource] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
@@ -1767,7 +1888,9 @@ def begin_migrate_to_stv2(
raw_result = self._migrate_to_stv2_initial(
resource_group_name=resource_group_name,
service_name=service_name,
+ parameters=parameters,
api_version=api_version,
+ content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
@@ -2116,7 +2239,7 @@ def check_name_availability(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiManagementServiceCheckNameAvailabilityParameters")
@@ -2215,7 +2338,7 @@ def get_domain_ownership_identifier(
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier"
}
- def _apply_network_configuration_updates_initial( # pylint: disable=name-too-long
+ def _apply_network_configuration_updates_initial(
self,
resource_group_name: str,
service_name: str,
@@ -2240,7 +2363,7 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
if parameters is not None:
@@ -2293,7 +2416,7 @@ def _apply_network_configuration_updates_initial( # pylint: disable=name-too-lo
}
@overload
- def begin_apply_network_configuration_updates( # pylint: disable=name-too-long
+ def begin_apply_network_configuration_updates(
self,
resource_group_name: str,
service_name: str,
@@ -2334,7 +2457,7 @@ def begin_apply_network_configuration_updates( # pylint: disable=name-too-long
"""
@overload
- def begin_apply_network_configuration_updates( # pylint: disable=name-too-long
+ def begin_apply_network_configuration_updates(
self,
resource_group_name: str,
service_name: str,
@@ -2374,7 +2497,7 @@ def begin_apply_network_configuration_updates( # pylint: disable=name-too-long
"""
@distributed_trace
- def begin_apply_network_configuration_updates( # pylint: disable=name-too-long
+ def begin_apply_network_configuration_updates(
self,
resource_group_name: str,
service_name: str,
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..8c88b2d0e559 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -36,13 +36,13 @@
_SERIALIZER.client_side_validation = False
-def build_list_available_service_skus_request( # pylint: disable=name-too-long
+def build_list_available_service_skus_request(
resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,10 +62,10 @@ def build_list_available_service_skus_request( # pylint: disable=name-too-long
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..6ea5e1705bd9 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,16 +40,16 @@ 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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus")
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..d43c488fd374 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,10 +73,10 @@ def build_list_by_api_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -100,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -122,10 +123,10 @@ def build_get_entity_tag_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -142,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -164,10 +165,10 @@ def build_get_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -191,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -214,10 +215,10 @@ def build_create_or_update_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -245,7 +246,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -268,10 +269,10 @@ def build_update_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -298,7 +299,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -320,10 +321,10 @@ def build_delete_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -762,7 +763,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "OperationContract")
@@ -953,7 +954,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "OperationUpdateContract")
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..b7ad55112786 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +41,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,10 +63,10 @@ def build_list_by_operation_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -88,7 +89,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -111,10 +112,10 @@ def build_get_entity_tag_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -139,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,10 +163,10 @@ def build_get_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if format is not None:
@@ -192,7 +193,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -216,10 +217,10 @@ def build_create_or_update_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -248,7 +249,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -271,10 +272,10 @@ def build_delete_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -695,7 +696,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
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..0854185b262c 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -29,7 +30,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -53,7 +54,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -73,10 +74,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -103,7 +104,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -124,10 +125,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -144,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -165,10 +166,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -191,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -213,10 +214,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -237,7 +238,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -259,10 +260,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -289,7 +290,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -310,10 +311,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if delete_revisions is not None:
@@ -341,7 +342,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -361,10 +362,10 @@ def build_list_by_tags_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -673,7 +674,7 @@ def _create_or_update_initial(
parameters: Union[_models.ApiCreateOrUpdateParameter, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.ApiContract]:
+ ) -> _models.ApiContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -687,12 +688,12 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.ApiContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.ApiContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiCreateOrUpdateParameter")
@@ -721,27 +722,34 @@ def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("ApiContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("ApiContract", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"
@@ -906,6 +914,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("ApiContract", pipeline_response)
if cls:
@@ -1057,7 +1069,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiUpdateContract")
@@ -1105,8 +1117,7 @@ def update(
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"
}
- @distributed_trace
- def delete( # pylint: disable=inconsistent-return-statements
+ def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
service_name: str,
@@ -1115,26 +1126,6 @@ def delete( # pylint: disable=inconsistent-return-statements
delete_revisions: Optional[bool] = None,
**kwargs: Any
) -> None:
- """Deletes the specified API of the API Management service instance.
-
- :param resource_group_name: The name of the resource group. The name is case insensitive.
- Required.
- :type resource_group_name: str
- :param service_name: The name of the API Management service. Required.
- :type service_name: str
- :param api_id: API revision identifier. Must be unique in the current API Management service
- instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
- :type api_id: str
- :param if_match: ETag of the Entity. ETag should match the current entity state from the header
- response of the GET request or it should be * for unconditional update. Required.
- :type if_match: str
- :param delete_revisions: Delete all revisions of the Api. Default value is None.
- :type delete_revisions: bool
- :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,
@@ -1157,7 +1148,7 @@ def delete( # pylint: disable=inconsistent-return-statements
if_match=if_match,
delete_revisions=delete_revisions,
api_version=api_version,
- template_url=self.delete.metadata["url"],
+ template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
@@ -1171,15 +1162,107 @@ def delete( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
- if response.status_code not in [200, 204]:
+ if response.status_code not in [202, 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)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
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}/apis/{apiId}"
+ }
+
+ @distributed_trace
+ def begin_delete(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ api_id: str,
+ if_match: str,
+ delete_revisions: Optional[bool] = None,
+ **kwargs: Any
+ ) -> LROPoller[None]:
+ """Deletes the specified API of the API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param api_id: API revision identifier. Must be unique in the current API Management service
+ instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
+ :type api_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param delete_revisions: Delete all revisions of the Api. Default value is None.
+ :type delete_revisions: bool
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either None or the result of cls(response)
+ :rtype: ~azure.core.polling.LROPoller[None]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._delete_initial( # type: ignore
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ api_id=api_id,
+ if_match=if_match,
+ delete_revisions=delete_revisions,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ 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
- delete.metadata = {
+ begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"
}
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..eedb7da8325f 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +41,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,10 +62,10 @@ def build_list_by_api_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -86,7 +87,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -108,10 +109,10 @@ def build_get_entity_tag_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -135,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", "2023-09-01-preview"))
accept = _headers.pop(
"Accept",
"application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml",
@@ -160,10 +161,10 @@ def build_get_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if format is not None:
@@ -189,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -212,10 +213,10 @@ def build_create_or_update_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -243,7 +244,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -265,10 +266,10 @@ def build_delete_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -669,7 +670,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
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..73f752c3c8ab 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_by_apis_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
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..e24c9bc68070 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -97,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -121,10 +122,10 @@ def build_get_entity_tag_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -141,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -165,10 +166,10 @@ def build_get_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -192,7 +193,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -217,10 +218,10 @@ def build_create_or_update_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -248,7 +249,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -273,10 +274,10 @@ def build_update_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -303,7 +304,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -327,10 +328,10 @@ def build_delete_request(
"releaseId": _SERIALIZER.url(
"release_id", release_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -763,7 +764,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiReleaseContract")
@@ -954,7 +955,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiReleaseContract")
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..09444762c964 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
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..72f5f73cf3e6 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -29,7 +30,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,7 +53,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -73,10 +74,10 @@ def build_list_by_api_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -99,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -121,10 +122,10 @@ def build_get_entity_tag_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -141,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -163,10 +164,10 @@ def build_get_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -190,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -213,10 +214,10 @@ def build_create_or_update_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -245,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -267,10 +268,10 @@ def build_delete_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if force is not None:
@@ -576,7 +577,7 @@ def _create_or_update_initial(
parameters: Union[_models.SchemaContract, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.SchemaContract]:
+ ) -> _models.SchemaContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -590,12 +591,12 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.SchemaContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.SchemaContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "SchemaContract")
@@ -625,27 +626,34 @@ def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("SchemaContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("SchemaContract", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"
@@ -823,6 +831,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("SchemaContract", pipeline_response)
if cls:
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..55c5df8a55fc 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -102,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -126,10 +127,10 @@ def build_get_entity_tag_request(
"tagDescriptionId": _SERIALIZER.url(
"tag_description_id", tag_description_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -151,7 +152,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -175,10 +176,10 @@ def build_get_request(
"tagDescriptionId": _SERIALIZER.url(
"tag_description_id", tag_description_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -202,7 +203,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -227,10 +228,10 @@ def build_create_or_update_request(
"tagDescriptionId": _SERIALIZER.url(
"tag_description_id", tag_description_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -258,7 +259,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -282,10 +283,10 @@ def build_delete_request(
"tagDescriptionId": _SERIALIZER.url(
"tag_description_id", tag_description_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -719,7 +720,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "TagDescriptionCreateParameters")
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..a59a8b176936 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -118,10 +119,10 @@ def build_get_entity_tag_request(
"versionSetId": _SERIALIZER.url(
"version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -138,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,10 +162,10 @@ def build_get_request(
"versionSetId": _SERIALIZER.url(
"version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -187,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -211,10 +212,10 @@ def build_create_or_update_request(
"versionSetId": _SERIALIZER.url(
"version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -241,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -265,10 +266,10 @@ def build_update_request(
"versionSetId": _SERIALIZER.url(
"version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -294,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -317,10 +318,10 @@ def build_delete_request(
"versionSetId": _SERIALIZER.url(
"version_set_id", version_set_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -724,7 +725,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiVersionSetContract")
@@ -902,7 +903,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ApiVersionSetUpdateParameters")
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..c95f8a7e9593 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +41,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,10 +62,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -102,10 +103,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -128,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -150,10 +151,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -174,7 +175,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -196,10 +197,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -219,7 +220,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -240,10 +241,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -534,7 +535,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "WikiContract")
@@ -712,7 +713,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "WikiUpdateContract")
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..f3a26d77f871 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
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..4a26ba1a9a29 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +52,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -82,10 +83,10 @@ def build_list_by_authorization_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -114,7 +115,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -153,10 +154,10 @@ def build_get_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -181,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -221,10 +222,10 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -253,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -292,10 +293,10 @@ def build_delete_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -669,7 +670,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationAccessPolicyContract")
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..a1f3a456f4cf 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +46,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -77,10 +78,10 @@ def build_post_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -230,7 +231,7 @@ def post(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationLoginRequestContract")
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..c94bb5e2e089 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -36,7 +37,7 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_authorization_provider_request( # pylint: disable=name-too-long
+def build_list_by_authorization_provider_request(
resource_group_name: str,
service_name: str,
authorization_provider_id: str,
@@ -50,7 +51,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -78,10 +79,10 @@ def build_list_by_authorization_provider_request( # pylint: disable=name-too-lo
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -109,7 +110,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -140,10 +141,10 @@ def build_get_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -167,7 +168,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -199,10 +200,10 @@ def build_create_or_update_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -230,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -261,10 +262,10 @@ def build_delete_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -287,7 +288,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -319,10 +320,10 @@ def build_confirm_consent_code_request(
"authorizationId": _SERIALIZER.url(
"authorization_id", authorization_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -679,7 +680,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationContract")
@@ -931,7 +932,7 @@ def confirm_consent_code( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationConfirmConsentCodeRequestContract")
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..12aa6cda2e8b 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -123,10 +124,10 @@ def build_get_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -149,7 +150,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -178,10 +179,10 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -208,7 +209,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -236,10 +237,10 @@ def build_delete_request(
min_length=1,
pattern=r"^[^*#&+:<>?]+$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -575,7 +576,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationProviderContract")
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..d6e024b6a4c7 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -116,10 +117,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -136,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -157,10 +158,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -205,10 +206,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -229,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -251,10 +252,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -274,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -295,10 +296,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -316,7 +317,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -337,10 +338,10 @@ def build_list_secrets_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"authsid": _SERIALIZER.url("authsid", authsid, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -741,7 +742,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationServerContract")
@@ -916,7 +917,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AuthorizationServerUpdateContract")
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..d63aaa6a7c22 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -116,10 +117,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -136,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -157,10 +158,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -205,10 +206,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -229,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -251,10 +252,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -274,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -295,10 +296,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -316,7 +317,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -338,10 +339,10 @@ def build_reconnect_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"backendId": _SERIALIZER.url("backend_id", backend_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -747,7 +748,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "BackendContract")
@@ -925,7 +926,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "BackendUpdateParameters")
@@ -1157,7 +1158,7 @@ def reconnect( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
if parameters is not None:
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..6975224764d6 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -48,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -68,10 +69,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if top is not None:
@@ -92,7 +93,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -113,10 +114,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -133,7 +134,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -154,10 +155,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -180,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -202,10 +203,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -226,7 +227,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -248,10 +249,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -271,7 +272,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -292,10 +293,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"cacheId": _SERIALIZER.url("cache_id", cache_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -699,7 +700,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "CacheContract")
@@ -877,7 +878,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "CacheUpdateParameters")
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..104c0f15e209 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,10 +71,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -100,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -123,10 +124,10 @@ def build_get_entity_tag_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -143,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -166,10 +167,10 @@ def build_get_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -192,7 +193,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -216,10 +217,10 @@ def build_create_or_update_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -246,7 +247,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -269,10 +270,10 @@ def build_delete_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -290,7 +291,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -313,10 +314,10 @@ def build_refresh_secret_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -738,7 +739,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "CertificateCreateOrUpdateParameters")
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..0230a19427bb 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +43,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,10 +64,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -88,7 +89,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -110,10 +111,10 @@ def build_get_entity_tag_request(
),
"contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1),
"contentItemId": _SERIALIZER.url("content_item_id", content_item_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -135,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -157,10 +158,10 @@ def build_get_request(
),
"contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1),
"contentItemId": _SERIALIZER.url("content_item_id", content_item_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -184,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -207,10 +208,10 @@ def build_create_or_update_request(
),
"contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1),
"contentItemId": _SERIALIZER.url("content_item_id", content_item_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -238,7 +239,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -260,10 +261,10 @@ def build_delete_request(
),
"contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1),
"contentItemId": _SERIALIZER.url("content_item_id", content_item_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -665,7 +666,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ContentItemContract")
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..11d57c8b8efd 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +43,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,10 +63,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -82,7 +83,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -103,10 +104,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -129,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -151,10 +152,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -181,7 +182,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -202,10 +203,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"contentTypeId": _SERIALIZER.url("content_type_id", content_type_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -528,7 +529,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ContentTypeContract")
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..7bf7bd7eea5f 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +41,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -60,10 +61,10 @@ def build_get_entity_tag_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -78,7 +79,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -98,10 +99,10 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -118,7 +119,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -139,10 +140,10 @@ def build_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -162,7 +163,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -183,10 +184,10 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -207,7 +208,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -227,10 +228,10 @@ def build_list_secrets_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -501,7 +502,7 @@ def update( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalDelegationSettings")
@@ -653,7 +654,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalDelegationSettings")
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..170ffabad92b 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
@@ -29,7 +29,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -50,10 +50,10 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H
"template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices"
)
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -85,11 +85,11 @@ def build_get_by_name_request(service_name: str, location: str, subscription_id:
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"location": _SERIALIZER.url("location", location, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -121,11 +121,11 @@ def build_purge_request(service_name: str, location: str, subscription_id: str,
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"location": _SERIALIZER.url("location", location, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..e393cc756fe0 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -118,10 +119,10 @@ def build_get_entity_tag_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -138,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,10 +162,10 @@ def build_get_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -187,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -211,10 +212,10 @@ def build_create_or_update_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -241,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -265,10 +266,10 @@ def build_update_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -294,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -317,10 +318,10 @@ def build_delete_request(
"diagnosticId": _SERIALIZER.url(
"diagnostic_id", diagnostic_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -724,7 +725,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DiagnosticContract")
@@ -902,7 +903,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DiagnosticContract")
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..0c0d9a670d91 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -118,10 +119,10 @@ def build_get_entity_tag_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -138,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,10 +162,10 @@ def build_get_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -187,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -211,10 +212,10 @@ def build_create_or_update_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -241,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -265,10 +266,10 @@ def build_update_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -294,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -317,10 +318,10 @@ def build_delete_request(
"documentationId": _SERIALIZER.url(
"documentation_id", documentation_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -724,7 +725,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DocumentationContract")
@@ -902,7 +903,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DocumentationUpdateContract")
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..4f48377b4aba 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -99,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -120,10 +121,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"templateName": _SERIALIZER.url("template_name", template_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -144,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -165,10 +166,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"templateName": _SERIALIZER.url("template_name", template_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -191,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -213,10 +214,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"templateName": _SERIALIZER.url("template_name", template_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -243,7 +244,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -265,10 +266,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"templateName": _SERIALIZER.url("template_name", template_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -294,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -315,10 +316,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"templateName": _SERIALIZER.url("template_name", template_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -763,7 +764,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "EmailTemplateUpdateParameters")
@@ -954,7 +955,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "EmailTemplateUpdateParameters")
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..530b74d8b9f8 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -97,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,10 +120,10 @@ def build_get_entity_tag_request(
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -139,7 +140,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -162,10 +163,10 @@ def build_create_or_update_request(
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -184,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -206,10 +207,10 @@ def build_delete_request(
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -550,7 +551,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
if parameters is not None:
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..39454d71e02c 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -102,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -126,10 +127,10 @@ def build_get_entity_tag_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -151,7 +152,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -175,10 +176,10 @@ def build_get_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -202,7 +203,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -227,10 +228,10 @@ def build_create_or_update_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -258,7 +259,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -282,10 +283,10 @@ def build_delete_request(
"certificateId": _SERIALIZER.url(
"certificate_id", certificate_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -716,7 +717,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayCertificateAuthorityContract")
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..393d51cf2113 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -97,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,10 +120,10 @@ def build_get_entity_tag_request(
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
"hcId": _SERIALIZER.url("hc_id", hc_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -139,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,10 +162,10 @@ def build_get_request(
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
"hcId": _SERIALIZER.url("hc_id", hc_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -188,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -211,10 +212,10 @@ def build_create_or_update_request(
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
"hcId": _SERIALIZER.url("hc_id", hc_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -242,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -264,10 +265,10 @@ def build_delete_request(
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
"hcId": _SERIALIZER.url("hc_id", hc_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -702,7 +703,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayHostnameConfigurationContract")
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..08852e2d5ec1 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -116,10 +117,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -136,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -157,10 +158,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -205,10 +206,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -229,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -251,10 +252,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -274,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -295,10 +296,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -316,7 +317,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -337,10 +338,10 @@ def build_list_keys_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -357,7 +358,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -379,10 +380,10 @@ def build_regenerate_key_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -401,7 +402,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -423,10 +424,139 @@ def build_generate_token_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_invalidate_debug_credentials_request(
+ resource_group_name: str, service_name: str, gateway_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/gateways/{gatewayId}/invalidateDebugCredentials",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_debug_credentials_request(
+ resource_group_name: str, service_name: str, gateway_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/gateways/{gatewayId}/listDebugCredentials",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_trace_request(
+ resource_group_name: str, service_name: str, gateway_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/gateways/{gatewayId}/listTrace",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str", max_length=80, min_length=1),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -832,7 +962,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayContract")
@@ -1009,7 +1139,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayContract")
@@ -1310,7 +1440,7 @@ def regenerate_key( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayKeyRegenerationRequestContract")
@@ -1461,7 +1591,7 @@ def generate_token(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GatewayTokenRequestContract")
@@ -1504,3 +1634,380 @@ def generate_token(
generate_token.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken"
}
+
+ @distributed_trace
+ def invalidate_debug_credentials( # pylint: disable=inconsistent-return-statements
+ self, resource_group_name: str, service_name: str, gateway_id: str, **kwargs: Any
+ ) -> None:
+ """Action is invalidating all debug credentials issued for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :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_invalidate_debug_credentials_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ template_url=self.invalidate_debug_credentials.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, {})
+
+ invalidate_debug_credentials.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/invalidateDebugCredentials"
+ }
+
+ @overload
+ def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: _models.GatewayListDebugCredentialsContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: IO,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Required.
+ :type parameters: IO
+ :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: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def list_debug_credentials(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: Union[_models.GatewayListDebugCredentialsContract, IO],
+ **kwargs: Any
+ ) -> _models.GatewayDebugCredentialsContract:
+ """Create new debug credentials for gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List debug credentials properties. Is either a
+ GatewayListDebugCredentialsContract type or a IO type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListDebugCredentialsContract 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: GatewayDebugCredentialsContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.GatewayDebugCredentialsContract
+ :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.GatewayDebugCredentialsContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GatewayListDebugCredentialsContract")
+
+ request = build_list_debug_credentials_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ template_url=self.list_debug_credentials.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("GatewayDebugCredentialsContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_debug_credentials.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listDebugCredentials"
+ }
+
+ @overload
+ def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: _models.GatewayListTraceContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListTraceContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: IO,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Required.
+ :type parameters: IO
+ :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: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def list_trace(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ gateway_id: str,
+ parameters: Union[_models.GatewayListTraceContract, IO],
+ **kwargs: Any
+ ) -> Dict[str, Any]:
+ """Fetches trace collected by gateway.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param gateway_id: Gateway entity identifier. Must be unique in the current API Management
+ service instance. Must not have value 'managed'. Required.
+ :type gateway_id: str
+ :param parameters: List trace properties. Is either a GatewayListTraceContract type or a IO
+ type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.GatewayListTraceContract 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: dict mapping str to any or the result of cls(response)
+ :rtype: dict[str, any]
+ :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[Dict[str, Any]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GatewayListTraceContract")
+
+ request = build_list_trace_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ gateway_id=gateway_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ template_url=self.list_trace.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("{object}", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+
+ list_trace.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listTrace"
+ }
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..d7f91add0811 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -29,7 +30,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -97,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -118,10 +119,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -138,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -159,10 +160,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -185,7 +186,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -207,10 +208,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -231,7 +232,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -252,10 +253,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"schemaId": _SERIALIZER.url("schema_id", schema_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -544,7 +545,7 @@ def _create_or_update_initial(
parameters: Union[_models.GlobalSchemaContract, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.GlobalSchemaContract]:
+ ) -> _models.GlobalSchemaContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -558,12 +559,12 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.GlobalSchemaContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.GlobalSchemaContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GlobalSchemaContract")
@@ -592,27 +593,34 @@ def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"
@@ -777,6 +785,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
if cls:
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..3e82bb462f65 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_api_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -97,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,10 +120,10 @@ def build_get_entity_tag_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -139,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,10 +162,10 @@ def build_get_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -188,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -211,10 +212,10 @@ def build_create_or_update_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -242,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -265,10 +266,10 @@ def build_update_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -295,7 +296,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -317,10 +318,10 @@ def build_delete_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -753,7 +754,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ResolverContract")
@@ -944,7 +945,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ResolverUpdateContract")
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..1237f4412bea 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +43,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -64,10 +65,10 @@ def build_list_by_resolver_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -90,7 +91,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -113,10 +114,10 @@ def build_get_entity_tag_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -141,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -164,10 +165,10 @@ def build_get_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if format is not None:
@@ -194,7 +195,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -218,10 +219,10 @@ def build_create_or_update_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -250,7 +251,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -273,10 +274,10 @@ def build_delete_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"resolverId": _SERIALIZER.url("resolver_id", resolver_id, "str", max_length=80, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -725,7 +726,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
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..87e95ad5ea24 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -116,10 +117,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -136,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -157,10 +158,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -205,10 +206,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -229,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -251,10 +252,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -274,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -295,10 +296,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -705,7 +706,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GroupCreateParameters")
@@ -883,7 +884,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "GroupUpdateParameters")
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..c6ed822f8fbe 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,10 +119,10 @@ def build_check_entity_exists_request(
),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,10 +161,10 @@ def build_create_request(
),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -203,10 +203,10 @@ def build_delete_request(
),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..e9a4fccba585 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +43,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,10 +63,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -86,7 +87,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -107,10 +108,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -131,7 +132,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -152,10 +153,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -178,7 +179,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -200,10 +201,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -230,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -252,10 +253,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -281,7 +282,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -302,10 +303,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -327,7 +328,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -348,10 +349,10 @@ def build_list_secrets_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -752,7 +753,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IdentityProviderCreateContract")
@@ -930,7 +931,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "IdentityProviderUpdateParameters")
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..e61e3203d13b 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +69,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -118,10 +118,10 @@ def build_get_request(
"issueId": _SERIALIZER.url(
"issue_id", issue_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..19410651471f 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -116,10 +117,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -136,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -157,10 +158,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -205,10 +206,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -229,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -251,10 +252,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -274,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -295,10 +296,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"loggerId": _SERIALIZER.url("logger_id", logger_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -704,7 +705,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "LoggerContract")
@@ -882,7 +883,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "LoggerUpdateContract")
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..fe6d52903353 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -29,7 +30,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -52,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,10 +73,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -102,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -125,10 +126,10 @@ def build_get_entity_tag_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -145,7 +146,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -168,10 +169,10 @@ def build_get_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -194,7 +195,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -218,10 +219,10 @@ def build_create_or_update_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -248,7 +249,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -272,10 +273,10 @@ def build_update_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -301,7 +302,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -324,10 +325,10 @@ def build_delete_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -345,7 +346,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -368,10 +369,10 @@ def build_list_value_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -388,7 +389,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -411,10 +412,10 @@ def build_refresh_secret_request(
"namedValueId": _SERIALIZER.url(
"named_value_id", named_value_id, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -708,7 +709,7 @@ def _create_or_update_initial(
parameters: Union[_models.NamedValueCreateContract, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.NamedValueContract]:
+ ) -> _models.NamedValueContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -722,12 +723,12 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.NamedValueContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.NamedValueContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "NamedValueCreateContract")
@@ -756,27 +757,34 @@ def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("NamedValueContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("NamedValueContract", pipeline_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"
@@ -938,6 +946,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("NamedValueContract", pipeline_response)
if cls:
@@ -992,7 +1004,7 @@ def _update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "NamedValueUpdateParameters")
@@ -1033,6 +1045,12 @@ def _update_initial(
deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -1413,6 +1431,12 @@ 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"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
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..ed47bd9febae 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
@@ -25,7 +25,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -49,7 +49,7 @@ def build_list_by_service_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -63,7 +63,7 @@ def build_list_by_service_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -89,7 +89,7 @@ def build_list_by_location_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -104,7 +104,7 @@ def build_list_by_location_request(
"locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..6c59726b3572 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -68,10 +68,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if top is not None:
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,10 +117,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -164,10 +164,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..1176e1e05a27 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
@@ -25,7 +25,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,10 +65,10 @@ def build_list_by_notification_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -112,10 +112,10 @@ def build_check_entity_exists_request(
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
"email": _SERIALIZER.url("email", email, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -159,10 +159,10 @@ def build_create_or_update_request(
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
"email": _SERIALIZER.url("email", email, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -206,10 +206,10 @@ def build_delete_request(
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
"email": _SERIALIZER.url("email", email, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..79138083fafb 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
@@ -25,7 +25,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,10 +65,10 @@ def build_list_by_notification_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -112,10 +112,10 @@ def build_check_entity_exists_request(
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -159,10 +159,10 @@ def build_create_or_update_request(
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -206,10 +206,10 @@ def build_delete_request(
),
"notificationName": _SERIALIZER.url("notification_name", notification_name, "str"),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..c22ed8931c4c 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -116,10 +117,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -136,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -157,10 +158,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -205,10 +206,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -229,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -251,10 +252,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -274,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -295,10 +296,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -316,7 +317,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -337,10 +338,10 @@ def build_list_secrets_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"opid": _SERIALIZER.url("opid", opid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -741,7 +742,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "OpenidConnectProviderContract")
@@ -916,7 +917,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "OpenidConnectProviderUpdateContract")
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..c438e837aa25 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,10 +72,10 @@ def build_list_by_tags_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
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..15c0c33839e8 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
@@ -25,7 +25,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -49,7 +49,7 @@ def build_list_by_service_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -63,7 +63,7 @@ def build_list_by_service_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..61fcd4959efa 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
@@ -25,7 +25,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,10 +65,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if scope is not None:
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..84f3b78f7109 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,9 @@
# 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 io import IOBase
+from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -16,6 +18,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
@@ -27,7 +30,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,10 +73,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -98,7 +101,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,10 +122,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -145,7 +148,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -166,10 +169,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -194,7 +197,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -216,10 +219,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -240,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -261,10 +264,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -289,7 +292,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -310,10 +313,10 @@ def build_list_references_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"id": _SERIALIZER.url("id", id, "str", max_length=80, min_length=1, pattern=r"(^[\w]+$)|(^[\w][\w\-]+[\w]$)"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -357,7 +360,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 +382,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 +401,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"
@@ -590,7 +621,7 @@ def _create_or_update_initial(
parameters: Union[_models.PolicyFragmentContract, IO],
if_match: Optional[str] = None,
**kwargs: Any
- ) -> Optional[_models.PolicyFragmentContract]:
+ ) -> _models.PolicyFragmentContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -604,12 +635,12 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PolicyFragmentContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.PolicyFragmentContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyFragmentContract")
@@ -638,30 +669,34 @@ def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [200, 201, 202]:
+ if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
if response.status_code == 200:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
if response.status_code == 201:
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
- 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 cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
+ return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}"
@@ -823,6 +858,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
if cls:
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..2c93a5729502 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,9 @@
# 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 io import IOBase
+from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -16,6 +18,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
@@ -25,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +43,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -60,10 +63,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -84,7 +87,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -105,10 +108,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -131,7 +134,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -152,10 +155,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if format is not None:
@@ -180,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -202,10 +205,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -232,7 +235,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -253,10 +256,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -288,7 +291,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 +302,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 +320,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"
@@ -620,7 +652,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_operations.py
new file mode 100644
index 000000000000..99c2088abac7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_operations.py
@@ -0,0 +1,991 @@
+# 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 io import IOBase
+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
+
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_list_by_service_request(
+ resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/policyRestrictions",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, policy_restriction_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, policy_restriction_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/policyRestrictions/{policyRestrictionId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "policyRestrictionId": _SERIALIZER.url(
+ "policy_restriction_id", policy_restriction_id, "str", max_length=80, min_length=1
+ ),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class PolicyRestrictionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`policy_restriction` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> Iterable["_models.PolicyRestrictionContract"]:
+ """Gets all policy restrictions of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: An iterator like instance of either PolicyRestrictionContract or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PolicyRestrictionContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.PolicyRestrictionCollection] = kwargs.pop("cls", None)
+
+ error_map = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ request = build_list_by_service_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ 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("PolicyRestrictionCollection", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ return pipeline_response
+
+ return ItemPaged(get_next, extract_data)
+
+ list_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyRestrictions"
+ }
+
+ @distributed_trace
+ def get_entity_tag(
+ self, resource_group_name: str, service_name: str, policy_restriction_id: str, **kwargs: Any
+ ) -> bool:
+ """Gets the entity state (Etag) version of the policy restriction in the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :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,
+ policy_restriction_id=policy_restriction_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}/policyRestrictions/{policyRestrictionId}"
+ }
+
+ @distributed_trace
+ def get(
+ self, resource_group_name: str, service_name: str, policy_restriction_id: str, **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Get the policy restriction of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :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.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ request = build_get_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ 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("PolicyRestrictionContract", 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}/policyRestrictions/{policyRestrictionId}"
+ }
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: _models.PolicyRestrictionContract,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: IO,
+ if_match: Optional[str] = None,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: IO
+ :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: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def create_or_update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ parameters: Union[_models.PolicyRestrictionContract, IO],
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Creates or updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param parameters: The policy restriction to apply. Is either a PolicyRestrictionContract type
+ or a IO type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract 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: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :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.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyRestrictionContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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("PolicyRestrictionContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+
+ deserialized = self._deserialize("PolicyRestrictionContract", 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}/policyRestrictions/{policyRestrictionId}"
+ }
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: _models.PolicyRestrictionUpdateContract,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionUpdateContract
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: IO,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Required.
+ :type parameters: IO
+ :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: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def update(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: str,
+ parameters: Union[_models.PolicyRestrictionUpdateContract, IO],
+ **kwargs: Any
+ ) -> _models.PolicyRestrictionContract:
+ """Updates the policy restriction configuration of the Api Management service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param parameters: The policy restriction to apply. Is either a PolicyRestrictionUpdateContract
+ type or a IO type. Required.
+ :type parameters: ~azure.mgmt.apimanagement.models.PolicyRestrictionUpdateContract 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: PolicyRestrictionContract or the result of cls(response)
+ :rtype: ~azure.mgmt.apimanagement.models.PolicyRestrictionContract
+ :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.PolicyRestrictionContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyRestrictionUpdateContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ policy_restriction_id=policy_restriction_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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("PolicyRestrictionContract", 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}/policyRestrictions/{policyRestrictionId}"
+ }
+
+ @distributed_trace
+ def delete( # pylint: disable=inconsistent-return-statements
+ self,
+ resource_group_name: str,
+ service_name: str,
+ policy_restriction_id: str,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """Deletes the policy restriction configuration of the Api Management Service.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param policy_restriction_id: Policy restrictions after an entity level. Required.
+ :type policy_restriction_id: str
+ :param if_match: ETag of the Entity. Not required when creating an entity, but required when
+ updating an entity. Default value is None.
+ :type if_match: str
+ :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,
+ policy_restriction_id=policy_restriction_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}/policyRestrictions/{policyRestrictionId}"
+ }
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_validations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_validations_operations.py
new file mode 100644
index 000000000000..fb86733483f5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_restriction_validations_operations.py
@@ -0,0 +1,225 @@
+# 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, cast
+
+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.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
+
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_by_service_request(
+ resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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}/validatePolicies",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "serviceName": _SERIALIZER.url(
+ "service_name",
+ service_name,
+ "str",
+ max_length=50,
+ min_length=1,
+ pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
+ ),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class PolicyRestrictionValidationsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`policy_restriction_validations` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ def _by_service_initial(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> Optional[_models.OperationResultContract]:
+ 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.OperationResultContract]] = kwargs.pop("cls", None)
+
+ request = build_by_service_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ template_url=self._by_service_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:
+ 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, response_headers)
+
+ return deserialized
+
+ _by_service_initial.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/validatePolicies"
+ }
+
+ @distributed_trace
+ def begin_by_service(
+ self, resource_group_name: str, service_name: str, **kwargs: Any
+ ) -> LROPoller[_models.OperationResultContract]:
+ """Validate all policies of API Management services.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :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 OperationResultContract or the result of
+ cls(response)
+ :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[_models.OperationResultContract] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._by_service_initial(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("OperationResultContract", pipeline_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+ 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_by_service.metadata = {
+ "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/validatePolicies"
+ }
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..7fa9509bd7a9 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,9 @@
# 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 io import IOBase
+from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -16,6 +18,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
@@ -25,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +43,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -60,10 +63,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -80,7 +83,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -89,7 +92,7 @@ def build_get_entity_tag_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -104,7 +107,7 @@ def build_get_entity_tag_request(
"portalConfigId": _SERIALIZER.url("portal_config_id", portal_config_id, "str", max_length=80, min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -121,7 +124,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -130,7 +133,7 @@ def build_get_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -145,7 +148,7 @@ def build_get_request(
"portalConfigId": _SERIALIZER.url("portal_config_id", portal_config_id, "str", max_length=80, min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -168,7 +171,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -178,7 +181,7 @@ def build_update_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -193,7 +196,7 @@ def build_update_request(
"portalConfigId": _SERIALIZER.url("portal_config_id", portal_config_id, "str", max_length=80, min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -219,7 +222,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -229,7 +232,7 @@ def build_create_or_update_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -244,7 +247,7 @@ def build_create_or_update_request(
"portalConfigId": _SERIALIZER.url("portal_config_id", portal_config_id, "str", max_length=80, min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -280,7 +283,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 +292,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 +311,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"
@@ -600,7 +631,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalConfigContract")
@@ -766,7 +797,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalConfigContract")
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..8fa7e666090f 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -29,7 +30,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -97,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -120,10 +121,10 @@ def build_get_entity_tag_request(
"portalRevisionId": _SERIALIZER.url(
"portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -140,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -163,10 +164,10 @@ def build_get_request(
"portalRevisionId": _SERIALIZER.url(
"portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -207,10 +208,10 @@ def build_create_or_update_request(
"portalRevisionId": _SERIALIZER.url(
"portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -235,7 +236,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -259,10 +260,10 @@ def build_update_request(
"portalRevisionId": _SERIALIZER.url(
"portal_revision_id", portal_revision_id, "str", max_length=256, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -562,7 +563,7 @@ def _create_or_update_initial(
portal_revision_id: str,
parameters: Union[_models.PortalRevisionContract, IO],
**kwargs: Any
- ) -> Optional[_models.PortalRevisionContract]:
+ ) -> _models.PortalRevisionContract:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
@@ -576,12 +577,12 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PortalRevisionContract]] = kwargs.pop("cls", None)
+ cls: ClsType[_models.PortalRevisionContract] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalRevisionContract")
@@ -609,17 +610,19 @@ def _create_or_update_initial(
response = pipeline_response.http_response
- if response.status_code not in [201, 202]:
+ if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 201:
- response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
- deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, response_headers)
@@ -778,6 +781,10 @@ def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
if cls:
@@ -832,7 +839,7 @@ def _update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalRevisionContract")
@@ -873,6 +880,12 @@ def _update_initial(
deserialized = self._deserialize("PortalRevisionContract", pipeline_response)
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
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..e13383aa7c22 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
@@ -25,7 +25,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -60,10 +60,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..7171d7520bc0 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
@@ -29,7 +30,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -44,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -53,7 +54,7 @@ def build_list_by_service_request(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections",
) # pylint: disable=line-too-long
path_format_arguments = {
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
@@ -67,7 +68,7 @@ def build_list_by_service_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -88,7 +89,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -111,10 +112,10 @@ def build_get_by_name_request(
"privateEndpointConnectionName": _SERIALIZER.url(
"private_endpoint_connection_name", private_endpoint_connection_name, "str"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -135,7 +136,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -159,10 +160,10 @@ def build_create_or_update_request(
"privateEndpointConnectionName": _SERIALIZER.url(
"private_endpoint_connection_name", private_endpoint_connection_name, "str"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -185,7 +186,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -208,10 +209,10 @@ def build_delete_request(
"privateEndpointConnectionName": _SERIALIZER.url(
"private_endpoint_connection_name", private_endpoint_connection_name, "str"
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -222,13 +223,13 @@ def build_delete_request(
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
-def build_list_private_link_resources_request( # pylint: disable=name-too-long
+def build_list_private_link_resources_request(
resource_group_name: str, service_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -240,7 +241,7 @@ def build_list_private_link_resources_request( # pylint: disable=name-too-long
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"serviceName": _SERIALIZER.url(
"service_name",
service_name,
@@ -251,7 +252,7 @@ def build_list_private_link_resources_request( # pylint: disable=name-too-long
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -272,7 +273,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -284,7 +285,7 @@ def build_get_private_link_resource_request(
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"serviceName": _SERIALIZER.url(
"service_name",
service_name,
@@ -298,7 +299,7 @@ def build_get_private_link_resource_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -516,7 +517,7 @@ def _create_or_update_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(private_endpoint_connection_request, (IO, bytes)):
+ if isinstance(private_endpoint_connection_request, (IOBase, bytes)):
_content = private_endpoint_connection_request
else:
_json = self._serialize.body(private_endpoint_connection_request, "PrivateEndpointConnectionRequest")
@@ -550,11 +551,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 +778,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..c8be201fa2e4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_link_operations.py
@@ -0,0 +1,681 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, product_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str, service_name: str, product_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str, service_name: str, product_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class ProductApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`product_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductApiLinkContract"]:
+ """Lists a collection of the API links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductApiLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..60dfae420496 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_by_product_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,10 +119,10 @@ def build_check_entity_exists_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,10 +161,10 @@ def build_create_or_update_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -203,10 +203,10 @@ def build_delete_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..16f220935ddb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_link_operations.py
@@ -0,0 +1,696 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class ProductGroupLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`product_group_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductGroupLinkContract"]:
+ """Lists a collection of the group links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| groupId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductGroupLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..87a108b52464 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_by_product_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,10 +119,10 @@ def build_check_entity_exists_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -161,10 +161,10 @@ def build_create_or_update_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -203,10 +203,10 @@ def build_delete_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..0086cba4671e 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +72,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -101,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -122,10 +123,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -142,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -163,10 +164,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -189,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -211,10 +212,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -235,7 +236,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -257,10 +258,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -287,7 +288,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -308,10 +309,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if delete_subscriptions is not None:
@@ -339,7 +340,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -359,10 +360,10 @@ def build_list_by_tags_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -788,7 +789,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ProductContract")
@@ -966,7 +967,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "ProductUpdateParameters")
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..cf4464667dc2 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,9 @@
# 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 io import IOBase
+from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -16,6 +18,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
@@ -25,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +43,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,10 +64,10 @@ def build_list_by_product_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -86,7 +89,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -108,10 +111,10 @@ def build_get_entity_tag_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -135,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -157,10 +160,10 @@ def build_get_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if format is not None:
@@ -186,7 +189,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -209,10 +212,10 @@ def build_create_or_update_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -240,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -262,10 +265,10 @@ def build_delete_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"policyId": _SERIALIZER.url("policy_id", policy_id, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -299,7 +302,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 +314,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 +332,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"
@@ -660,7 +690,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PolicyContract")
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..7a4597d617f5 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
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..46bbd654cb6a 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +41,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,10 +62,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -102,10 +103,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -128,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -150,10 +151,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -174,7 +175,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -196,10 +197,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -219,7 +220,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -240,10 +241,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -534,7 +535,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "WikiContract")
@@ -712,7 +713,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "WikiUpdateContract")
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..3d62d4f40b55 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
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..00022b66ca09 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +41,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -61,10 +62,10 @@ def build_list_by_service_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,7 +82,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -103,10 +104,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -337,7 +338,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "QuotaCounterValueUpdateContract")
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..f8f27deccaa6 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +46,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -67,10 +68,10 @@ def build_get_request(
),
"quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, "str"),
"quotaPeriodKey": _SERIALIZER.url("quota_period_key", quota_period_key, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -92,7 +93,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -115,10 +116,10 @@ def build_update_request(
),
"quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, "str"),
"quotaPeriodKey": _SERIALIZER.url("quota_period_key", quota_period_key, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -358,7 +359,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "QuotaCounterValueUpdateContract")
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..7e7f46a23cb2 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,10 +62,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..ae081e262829 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
@@ -28,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_by_api_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -126,10 +126,10 @@ def build_list_by_user_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -181,10 +181,10 @@ def build_list_by_operation_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -236,10 +236,10 @@ def build_list_by_product_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -290,10 +290,10 @@ def build_list_by_geo_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -343,10 +343,10 @@ def build_list_by_subscription_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -399,10 +399,10 @@ def build_list_by_time_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -454,10 +454,10 @@ def build_list_by_request_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["$filter"] = _SERIALIZER.query("filter", filter, "str")
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..6c417787227b 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +41,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -60,10 +61,10 @@ def build_get_entity_tag_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -78,7 +79,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -98,10 +99,10 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -118,7 +119,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -139,10 +140,10 @@ def build_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -162,7 +163,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -183,10 +184,10 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -461,7 +462,7 @@ def update( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalSigninSettings")
@@ -613,7 +614,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalSigninSettings")
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..e9f8e12f9a27 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -25,7 +26,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +41,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -60,10 +61,10 @@ def build_get_entity_tag_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -78,7 +79,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -98,10 +99,10 @@ def build_get_request(resource_group_name: str, service_name: str, subscription_
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -118,7 +119,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -139,10 +140,10 @@ def build_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -162,7 +163,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -183,10 +184,10 @@ def build_create_or_update_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -461,7 +462,7 @@ def update( # pylint: disable=inconsistent-return-statements
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalSignupSettings")
@@ -613,7 +614,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "PortalSignupSettings")
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..8d8db6690f6f 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +70,10 @@ def build_list_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -95,7 +96,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -116,10 +117,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -136,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -157,10 +158,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -185,7 +186,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -207,10 +208,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if notify is not None:
@@ -243,7 +244,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -265,10 +266,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if notify is not None:
@@ -292,7 +293,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -313,10 +314,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -334,7 +335,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -355,10 +356,10 @@ def build_regenerate_primary_key_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -375,7 +376,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -396,10 +397,10 @@ def build_regenerate_secondary_key_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -416,7 +417,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -437,10 +438,10 @@ def build_list_secrets_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -886,7 +887,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "SubscriptionCreateParameters")
@@ -1102,7 +1103,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "SubscriptionUpdateParameters")
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..48cc02916b29
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str, service_name: str, tag_id: str, api_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class TagApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`tag_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagApiLinkContract"]:
+ """Lists a collection of the API links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagApiLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..46f0ee08b4e3
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operation_link_operations.py
@@ -0,0 +1,696 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class TagOperationLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`tag_operation_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagOperationLinkContract"]:
+ """Lists a collection of the operation links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| operationId
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagOperationLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..69f7bc7467a0 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -51,7 +52,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -73,10 +74,10 @@ def build_list_by_operation_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -93,7 +94,7 @@ def build_list_by_operation_request(
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-def build_get_entity_state_by_operation_request( # pylint: disable=name-too-long
+def build_get_entity_state_by_operation_request(
resource_group_name: str,
service_name: str,
api_id: str,
@@ -105,7 +106,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -128,10 +129,10 @@ def build_get_entity_state_by_operation_request( # pylint: disable=name-too-lon
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -154,7 +155,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -177,10 +178,10 @@ def build_get_by_operation_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -203,7 +204,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -226,10 +227,10 @@ def build_assign_to_operation_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -252,7 +253,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -275,10 +276,10 @@ def build_detach_from_operation_request(
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", max_length=80, min_length=1),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -303,7 +304,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -324,10 +325,10 @@ def build_list_by_api_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -350,7 +351,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -372,10 +373,10 @@ def build_get_entity_state_by_api_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -392,7 +393,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -414,10 +415,10 @@ def build_get_by_api_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -434,7 +435,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -456,10 +457,10 @@ def build_assign_to_api_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -476,7 +477,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -498,10 +499,10 @@ def build_detach_from_api_request(
),
"apiId": _SERIALIZER.url("api_id", api_id, "str", max_length=256, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -526,7 +527,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -547,10 +548,10 @@ def build_list_by_product_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -567,13 +568,13 @@ def build_list_by_product_request(
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-def build_get_entity_state_by_product_request( # pylint: disable=name-too-long
+def build_get_entity_state_by_product_request(
resource_group_name: str, service_name: str, product_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-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -595,10 +596,10 @@ def build_get_entity_state_by_product_request( # pylint: disable=name-too-long
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -615,7 +616,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -637,10 +638,10 @@ def build_get_by_product_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -657,7 +658,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -679,10 +680,10 @@ def build_assign_to_product_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -699,7 +700,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -721,10 +722,10 @@ def build_detach_from_product_request(
),
"productId": _SERIALIZER.url("product_id", product_id, "str", max_length=256, min_length=1),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -749,7 +750,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -769,10 +770,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -797,7 +798,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -818,10 +819,10 @@ def build_get_entity_state_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -838,7 +839,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -859,10 +860,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -885,7 +886,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -907,10 +908,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -931,7 +932,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -953,10 +954,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -976,7 +977,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -997,10 +998,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"tagId": _SERIALIZER.url("tag_id", tag_id, "str", max_length=80, min_length=1, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -2666,7 +2667,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "TagCreateUpdateParameters")
@@ -2844,7 +2845,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "TagCreateUpdateParameters")
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..1eda86843c8d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_product_link_operations.py
@@ -0,0 +1,681 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str, service_name: str, tag_id: str, product_link_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class TagProductLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`tag_product_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagProductLinkContract"]:
+ """Lists a collection of the product links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| productId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagProductLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..ac12473ca6b4 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -69,10 +69,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
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..8637b3eff0b0 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
@@ -25,7 +25,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -64,11 +64,11 @@ def build_regenerate_primary_key_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,11 +109,11 @@ def build_regenerate_secondary_key_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..a7a5afa617ba 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -42,7 +43,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,10 +63,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -88,7 +89,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -108,11 +109,11 @@ def build_get_entity_tag_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -133,7 +134,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -153,11 +154,11 @@ def build_get_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -180,7 +181,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -202,10 +203,10 @@ def build_create_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -231,7 +232,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -253,10 +254,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -280,7 +281,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -300,11 +301,11 @@ def build_regenerate_primary_key_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -325,7 +326,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -345,11 +346,11 @@ def build_regenerate_secondary_key_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -370,7 +371,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -390,11 +391,11 @@ def build_list_secrets_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"accessName": _SERIALIZER.url("access_name", access_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -786,7 +787,7 @@ def create(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AccessInformationCreateParameters")
@@ -958,7 +959,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "AccessInformationUpdateParameters")
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..706b07262aa4 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
@@ -6,6 +6,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
from azure.core.exceptions import (
@@ -27,7 +28,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -46,7 +47,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -67,11 +68,11 @@ def build_deploy_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -94,7 +95,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -115,11 +116,11 @@ def build_save_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -142,7 +143,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -163,11 +164,11 @@ def build_validate_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -190,7 +191,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -210,11 +211,11 @@ def build_get_sync_state_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"configurationName": _SERIALIZER.url("configuration_name", configuration_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -270,7 +271,7 @@ def _deploy_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DeployConfigurationParameters")
@@ -304,11 +305,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
@@ -526,7 +531,7 @@ def _save_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "SaveConfigurationParameter")
@@ -560,11 +565,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
@@ -782,7 +791,7 @@ def _validate_initial(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "DeployConfigurationParameters")
@@ -816,11 +825,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..3392b05e2e9d 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -62,10 +62,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -108,11 +108,11 @@ def build_get_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
"settingsType": _SERIALIZER.url("settings_type", settings_type, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..7b15428153a6 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
@@ -25,7 +25,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -67,10 +67,10 @@ def build_send_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..1318cc790122 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
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..7a04f562516c 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,10 +63,10 @@ def build_list_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..b9a222e3972a 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
@@ -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, Iterable, Optional, TypeVar, Union, overload
+from io import IOBase
+from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,14 +21,16 @@
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
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +53,7 @@ def build_list_by_service_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,10 +73,10 @@ def build_list_by_service_request(
min_length=1,
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -98,7 +101,7 @@ def build_get_entity_tag_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,10 +122,10 @@ def build_get_entity_tag_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -139,7 +142,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -160,10 +163,10 @@ def build_get_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -187,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -209,10 +212,10 @@ def build_create_or_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if notify is not None:
@@ -235,7 +238,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -257,10 +260,10 @@ def build_update_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -289,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -310,10 +313,10 @@ def build_delete_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if delete_subscriptions is not None:
@@ -337,7 +340,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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -358,10 +361,10 @@ def build_generate_sso_url_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -378,7 +381,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", "2023-09-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -400,10 +403,10 @@ def build_get_shared_access_token_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -824,7 +827,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "UserCreateParameters")
@@ -1003,7 +1006,7 @@ def update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "UserUpdateParameters")
@@ -1051,8 +1054,7 @@ def update(
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"
}
- @distributed_trace
- def delete( # pylint: disable=inconsistent-return-statements
+ def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
service_name: str,
@@ -1063,33 +1065,6 @@ def delete( # pylint: disable=inconsistent-return-statements
app_type: Optional[Union[str, _models.AppType]] = None,
**kwargs: Any
) -> None:
- """Deletes specific user.
-
- :param resource_group_name: The name of the resource group. The name is case insensitive.
- Required.
- :type resource_group_name: str
- :param service_name: The name of the API Management service. Required.
- :type service_name: str
- :param user_id: User identifier. Must be unique in the current API Management service instance.
- Required.
- :type user_id: str
- :param if_match: ETag of the Entity. ETag should match the current entity state from the header
- response of the GET request or it should be * for unconditional update. Required.
- :type if_match: str
- :param delete_subscriptions: Whether to delete user's subscription or not. Default value is
- None.
- :type delete_subscriptions: bool
- :param notify: Send an Account Closed Email notification to the User. Default value is None.
- :type notify: bool
- :param app_type: Determines the type of application which send the create user request. Default
- is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
- None.
- :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
- :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,
@@ -1114,7 +1089,7 @@ def delete( # pylint: disable=inconsistent-return-statements
notify=notify,
app_type=app_type,
api_version=api_version,
- template_url=self.delete.metadata["url"],
+ template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
@@ -1128,15 +1103,118 @@ def delete( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
- if response.status_code not in [200, 204]:
+ if response.status_code not in [202, 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)
+ response_headers = {}
+ if response.status_code == 202:
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
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}/users/{userId}"
+ }
+
+ @distributed_trace
+ def begin_delete(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ user_id: str,
+ if_match: str,
+ delete_subscriptions: Optional[bool] = None,
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+ ) -> LROPoller[None]:
+ """Deletes specific user.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param user_id: User identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type user_id: str
+ :param if_match: ETag of the Entity. ETag should match the current entity state from the header
+ response of the GET request or it should be * for unconditional update. Required.
+ :type if_match: str
+ :param delete_subscriptions: Whether to delete user's subscription or not. Default value is
+ None.
+ :type delete_subscriptions: bool
+ :param notify: Send an Account Closed Email notification to the User. Default value is None.
+ :type notify: bool
+ :param app_type: Determines the type of application which send the create user request. Default
+ is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is
+ None.
+ :type app_type: str or ~azure.mgmt.apimanagement.models.AppType
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
+ :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
+ operation to not poll, or pass in your own initialized polling object for a personal polling
+ strategy.
+ :paramtype polling: bool or ~azure.core.polling.PollingMethod
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ :return: An instance of LROPoller that returns either None or the result of cls(response)
+ :rtype: ~azure.core.polling.LROPoller[None]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._delete_initial( # type: ignore
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ user_id=user_id,
+ if_match=if_match,
+ delete_subscriptions=delete_subscriptions,
+ notify=notify,
+ app_type=app_type,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {})
+
+ 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
- delete.metadata = {
+ begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"
}
@@ -1322,7 +1400,7 @@ def get_shared_access_token(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(parameters, (IO, bytes)):
+ if isinstance(parameters, (IOBase, bytes)):
_content = parameters
else:
_json = self._serialize.body(parameters, "UserTokenParameters")
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..5a94067cac1e 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
@@ -27,7 +27,7 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import ApiManagementClientMixinABC, _convert_request, _format_url_section
+from .._vendor import ApiManagementClientMixinABC, _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,10 +71,10 @@ def build_list_request(
pattern=r"^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -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", "2023-09-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -119,10 +119,10 @@ def build_get_request(
),
"userId": _SERIALIZER.url("user_id", user_id, "str", max_length=80, min_length=1),
"sid": _SERIALIZER.url("sid", sid, "str", max_length=256, pattern=r"^[^*#&+:<>?]+$"),
- "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
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..1566211a9865
--- /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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["export"] = _SERIALIZER.query("export", export, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiExportOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_export` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ format: Union[str, _models.ExportFormat],
+ export: Union[str, _models.ExportApi],
+ **kwargs: Any
+ ) -> _models.ApiExportResult:
+ """Gets the details of the API specified by its identifier in the format specified to the Storage
+ Blob with SAS Key valid for 5 minutes.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API revision identifier. Must be unique in the current API Management service
+ instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
+ :type api_id: str
+ :param format: Format in which to export the Api Details to the Storage Blob with Sas Key valid
+ for 5 minutes. Known values are: "swagger-link", "wsdl-link", "wadl-link", "openapi-link", and
+ "openapi+json-link". Required.
+ :type format: str or ~azure.mgmt.apimanagement.models.ExportFormat
+ :param export: Query parameter required to export the API details. "true" Required.
+ :type export: str or ~azure.mgmt.apimanagement.models.ExportApi
+ :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..164736a06b18
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if tags is not None:
+ _params["tags"] = _SERIALIZER.query("tags", tags, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiOperationOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_operation` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ tags: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.OperationContract"]:
+ """Lists a collection of the operations for the specified API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API revision identifier. Must be unique in the current API Management service
+ instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param tags: Include tags in the response. Default value is None.
+ :type tags: str
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "OperationContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "OperationUpdateContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..63084bff9b00
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operation_policy_operations.py
@@ -0,0 +1,928 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiOperationPolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_operation_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_operation(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ operation_id: str,
+ **kwargs: Any
+ ) -> Iterable["_models.PolicyContract"]:
+ """Get the list of policy configuration at the API Operation level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API revision identifier. Must be unique in the current API Management service
+ instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
+ :type api_id: str
+ :param operation_id: Operation identifier within an API. Must be unique in the current API
+ Management service instance. Required.
+ :type operation_id: str
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ operation_id=operation_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..7477d591e5b0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_operations.py
@@ -0,0 +1,1221 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if tags is not None:
+ _params["tags"] = _SERIALIZER.query("tags", tags, "str")
+ if expand_api_version_set is not None:
+ _params["expandApiVersionSet"] = _SERIALIZER.query("expand_api_version_set", expand_api_version_set, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, api_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, api_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ delete_revisions: Optional[bool] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if delete_revisions is not None:
+ _params["deleteRevisions"] = _SERIALIZER.query("delete_revisions", delete_revisions, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ tags: Optional[str] = None,
+ expand_api_version_set: Optional[bool] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ApiContract"]:
+ """Lists all APIs of the workspace in an API Management service instance.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-apis
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith || path | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith || isCurrent | filter | eq, ne | |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param tags: Include tags in the response. Default value is None.
+ :type tags: str
+ :param expand_api_version_set: Include full ApiVersionSet resource in response. Default value
+ is None.
+ :type expand_api_version_set: bool
+ :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
+ ) -> _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[_models.ApiContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("ApiContract", pipeline_response)
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiUpdateContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..485873155005
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_policy_operations.py
@@ -0,0 +1,875 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiPolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self, resource_group_name: str, service_name: str, workspace_id: str, api_id: str, **kwargs: Any
+ ) -> Iterable["_models.PolicyContract"]:
+ """Get the policy configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API revision identifier. Must be unique in the current API Management service
+ instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
+ :type api_id: str
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..17cbf83285ff
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_release_operations.py
@@ -0,0 +1,1174 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ release_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiReleaseOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_release` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ApiReleaseContract"]:
+ """Lists all releases of an API. An API release is created when making an API Revision current.
+ Releases are also used to rollback to previous revisions. Results will be paged and can be
+ constrained by the $top and $skip parameters.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| notes |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiReleaseContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiReleaseContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ release_id=release_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..54651a9fdeed
--- /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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiRevisionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_revision` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ApiRevisionContract"]:
+ """Lists all revisions of an API.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiRevision
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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..b53b7387d156
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_schema_operations.py
@@ -0,0 +1,1010 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ schema_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ force: Optional[bool] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if force is not None:
+ _params["force"] = _SERIALIZER.query("force", force, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiSchemaOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_schema` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ api_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.SchemaContract"]:
+ """Get the schema configuration at the API level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param api_id: API revision identifier. Must be unique in the current API Management service
+ instance. Non-current revision has ;rev=n as a suffix where n is the revision number. Required.
+ :type api_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| contentType
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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
+ ) -> _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[_models.SchemaContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SchemaContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ api_id=api_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("SchemaContract", pipeline_response)
+ 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..60eb68ab30bb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_api_version_set_operations.py
@@ -0,0 +1,1104 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ version_set_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceApiVersionSetOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_api_version_set` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ApiVersionSetContract"]:
+ """Lists a collection of API Version Sets in the specified workspace with a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiVersionSetContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ApiVersionSetUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ version_set_id=version_set_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..b7e9cc11da0f
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_global_schema_operations.py
@@ -0,0 +1,953 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, schema_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, schema_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ schema_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceGlobalSchemaOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_global_schema` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.GlobalSchemaContract"]:
+ """Lists a collection of schemas registered with workspace in a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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
+ ) -> _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[_models.GlobalSchemaContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GlobalSchemaContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ schema_id=schema_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("GlobalSchemaContract", pipeline_response)
+ 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..a41f4d5af677
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_group_operations.py
@@ -0,0 +1,1089 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, group_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, group_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceGroupOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_group` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.GroupContract"]:
+ """Lists a collection of groups defined within a workspace in a service instance.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-create-groups
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || externalId | filter | eq | |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GroupCreateParameters")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "GroupUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ group_id=group_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..ed1983affb70
--- /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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_check_entity_exists_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceGroupUserOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_group_user` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ group_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.UserContract"]:
+ """Lists a collection of user entities associated with the group.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param group_id: Group identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type group_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || firstName
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || registrationDate | filter | ge, le, eq, ne, gt, lt | || note | filter | ge,
+ le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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..580917735009
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_named_value_operations.py
@@ -0,0 +1,1637 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if is_key_vault_refresh_failed is not None:
+ _params["isKeyVaultRefreshFailed"] = _SERIALIZER.query(
+ "is_key_vault_refresh_failed", is_key_vault_refresh_failed, "str"
+ )
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_value_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_refresh_secret_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ named_value_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceNamedValueOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_named_value` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ is_key_vault_refresh_failed: Optional[Union[str, _models.KeyVaultRefreshState]] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.NamedValueContract"]:
+ """Lists a collection of named values defined within a workspace in a service instance.
+
+ .. seealso::
+ - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-properties
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| tags |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param is_key_vault_refresh_failed: Query parameter to fetch named value entities based on
+ refresh status. Known values are: "true" and "false". Default value is None.
+ :type is_key_vault_refresh_failed: str or ~azure.mgmt.apimanagement.models.KeyVaultRefreshState
+ :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
+ ) -> _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[_models.NamedValueContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "NamedValueCreateContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("NamedValueContract", pipeline_response)
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "NamedValueUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ named_value_id=named_value_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ 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"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ 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..1cfb1aafb118
--- /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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceNotificationOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_notification` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.NotificationContract"]:
+ """Lists a collection of properties defined within a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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..d00af695e356
--- /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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_check_entity_exists_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ email: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceNotificationRecipientEmailOperations:
+ """
+ .. 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..465db42a3b7d
--- /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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_check_entity_exists_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ notification_name: Union[str, _models.NotificationName],
+ user_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceNotificationRecipientUserOperations:
+ """
+ .. 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..4de7a8b139eb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_operations.py
@@ -0,0 +1,1022 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.WorkspaceContract"]:
+ """Lists all workspaces of the API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| displayName
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "WorkspaceContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "WorkspaceContract")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..de13b7abeee0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_fragment_operations.py
@@ -0,0 +1,1107 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if orderby is not None:
+ _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ subscription_id: str,
+ *,
+ format: Optional[Union[str, _models.PolicyFragmentContentFormat]] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_references_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ id: str,
+ subscription_id: str,
+ *,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspacePolicyFragmentOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_policy_fragment` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ orderby: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.PolicyFragmentContract"]:
+ """Gets all policy fragments defined within a workspace.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param orderby: OData order by query option. Default value is None.
+ :type orderby: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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
+ ) -> _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[_models.PolicyFragmentContract] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(parameters, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyFragmentContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ id=id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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]:
+ map_error(status_code=response.status_code, response=response, 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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+
+ if response.status_code == 201:
+ response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
+
+ _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"))
+ response_headers["location"] = self._deserialize("str", response.headers.get("location"))
+ response_headers["Azure-AsyncOperation"] = self._deserialize(
+ "str", response.headers.get("Azure-AsyncOperation")
+ )
+
+ deserialized = self._deserialize("PolicyFragmentContract", pipeline_response)
+ 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..d0bbdfd7f0fc
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_policy_operations.py
@@ -0,0 +1,834 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspacePolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_api(
+ self, resource_group_name: str, service_name: str, workspace_id: str, **kwargs: Any
+ ) -> Iterable["_models.PolicyContract"]:
+ """Get the policy configuration at the workspace level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..6c3f55d49d78
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_api_link_operations.py
@@ -0,0 +1,750 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceProductApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_product_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductApiLinkContract"]:
+ """Lists a collection of the API links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductApiLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..185d50d3ee92
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_group_link_operations.py
@@ -0,0 +1,750 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ group_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceProductGroupLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_product_group_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductGroupLinkContract"]:
+ """Lists a collection of the group links associated with a product.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| groupId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductGroupLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ group_link_id=group_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..0147f896cb0b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_operations.py
@@ -0,0 +1,1111 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if expand_groups is not None:
+ _params["expandGroups"] = _SERIALIZER.query("expand_groups", expand_groups, "bool")
+ if tags is not None:
+ _params["tags"] = _SERIALIZER.query("tags", tags, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, product_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, product_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ delete_subscriptions: Optional[bool] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if delete_subscriptions is not None:
+ _params["deleteSubscriptions"] = _SERIALIZER.query("delete_subscriptions", delete_subscriptions, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceProductOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_product` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ expand_groups: Optional[bool] = None,
+ tags: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.ProductContract"]:
+ """Lists a collection of products in the specified workspace in a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || state | filter | eq | || groups | expand | | |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param expand_groups: When set to true, the response contains an array of groups that have
+ visibility to the product. The default is false. Default value is None.
+ :type expand_groups: bool
+ :param tags: Products which are part of a specific tag. Default value is None.
+ :type tags: str
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "ProductUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..7b40cbcb0072
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_product_policy_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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ format: Union[str, _models.PolicyExportFormat] = "xml",
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if format is not None:
+ _params["format"] = _SERIALIZER.query("format", format, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ product_id: str,
+ policy_id: Union[str, _models.PolicyIdName],
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceProductPolicyOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_product_policy` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self, resource_group_name: str, service_name: str, workspace_id: str, product_id: str, **kwargs: Any
+ ) -> _models.PolicyCollection:
+ """Get the policy configuration at the Product level.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param product_id: Product identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type product_id: str
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "PolicyContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ product_id=product_id,
+ policy_id=policy_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..1594fbe0bbfa
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_subscription_operations.py
@@ -0,0 +1,1523 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_tag_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ subscription_id: str,
+ *,
+ notify: Optional[bool] = None,
+ if_match: Optional[str] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if notify is not None:
+ _params["notify"] = _SERIALIZER.query("notify", notify, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if app_type is not None:
+ _params["appType"] = _SERIALIZER.query("app_type", app_type, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ notify: Optional[bool] = None,
+ app_type: Optional[Union[str, _models.AppType]] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if notify is not None:
+ _params["notify"] = _SERIALIZER.query("notify", notify, "bool")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if app_type is not None:
+ _params["appType"] = _SERIALIZER.query("app_type", app_type, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ sid: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_regenerate_primary_key_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_regenerate_secondary_key_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_secrets_request(
+ resource_group_name: str, service_name: str, workspace_id: str, sid: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceSubscriptionOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_subscription` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.SubscriptionContract"]:
+ """Lists all subscriptions of the workspace in an API Management service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ || stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
+ endswith || productId | filter | ge, le, eq, ne, gt, lt | substringof, contains,
+ startswith, endswith || state | filter | eq | || user | expand | |
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SubscriptionCreateParameters")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ notify=notify,
+ if_match=if_match,
+ app_type=app_type,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "SubscriptionUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ sid=sid,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ notify=notify,
+ app_type=app_type,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..c447b88e00f7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ api_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceTagApiLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_tag_api_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagApiLinkContract"]:
+ """Lists a collection of the API links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| apiId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagApiLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ api_link_id=api_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..9ef2c5ab3c5b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operation_link_operations.py
@@ -0,0 +1,750 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ operation_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceTagOperationLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_tag_operation_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagOperationLinkContract"]:
+ """Lists a collection of the operation links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| operationId
+ | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagOperationLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ operation_link_id=operation_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..d07c0ff339cd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_operations.py
@@ -0,0 +1,1086 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ if scope is not None:
+ _params["scope"] = _SERIALIZER.query("scope", scope, "str")
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_entity_state_request(
+ resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str, service_name: str, workspace_id: str, tag_id: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ if_match: Optional[str] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if if_match is not None:
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ subscription_id: str,
+ *,
+ if_match: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceTagOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_tag` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_service(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ scope: Optional[str] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagContract"]:
+ """Lists a collection of tags defined within a workspace in a service instance.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| name |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith ||
+ displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
+ |. Default value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :param scope: Scope like 'apis', 'products' or 'apis/{apiId}. Default value is None.
+ :type scope: str
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagCreateUpdateParameters")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagCreateUpdateParameters")
+
+ request = build_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ subscription_id=self._config.subscription_id,
+ if_match=if_match,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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..fafbf7c4a095
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_workspace_tag_product_link_operations.py
@@ -0,0 +1,750 @@
+# 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 io import IOBase
+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
+
+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", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if filter is not None:
+ _params["$filter"] = _SERIALIZER.query("filter", filter, "str")
+ if top is not None:
+ _params["$top"] = _SERIALIZER.query("top", top, "int", minimum=1)
+ if skip is not None:
+ _params["$skip"] = _SERIALIZER.query("skip", skip, "int", minimum=0)
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_get_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_delete_request(
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ product_link_id: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-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"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class WorkspaceTagProductLinkOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.apimanagement.ApiManagementClient`'s
+ :attr:`workspace_tag_product_link` attribute.
+ """
+
+ models = _models
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+
+ @distributed_trace
+ def list_by_product(
+ self,
+ resource_group_name: str,
+ service_name: str,
+ workspace_id: str,
+ tag_id: str,
+ filter: Optional[str] = None,
+ top: Optional[int] = None,
+ skip: Optional[int] = None,
+ **kwargs: Any
+ ) -> Iterable["_models.TagProductLinkContract"]:
+ """Lists a collection of the product links associated with a tag.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param service_name: The name of the API Management service. Required.
+ :type service_name: str
+ :param workspace_id: Workspace identifier. Must be unique in the current API Management service
+ instance. Required.
+ :type workspace_id: str
+ :param tag_id: Tag identifier. Must be unique in the current API Management service instance.
+ Required.
+ :type tag_id: str
+ :param filter: | Field | Usage | Supported operators | Supported
+ functions ||-------------|-------------|-------------|-------------|| productId |
+ filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |. Default
+ value is None.
+ :type filter: str
+ :param top: Number of records to return. Default value is None.
+ :type top: int
+ :param skip: Number of records to skip. Default value is None.
+ :type skip: int
+ :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, (IOBase, bytes)):
+ _content = parameters
+ else:
+ _json = self._serialize.body(parameters, "TagProductLinkContract")
+
+ request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ service_name=service_name,
+ workspace_id=workspace_id,
+ tag_id=tag_id,
+ product_link_id=product_link_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ 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_get_reports_by_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_all_policies.py
similarity index 81%
rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_api.py
rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_all_policies.py
index 901172a34a39..69ef67e30bc2 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_all_policies.py
@@ -14,7 +14,7 @@
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
- python api_management_get_reports_by_api.py
+ python api_management_all_policies.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.reports.list_by_api(
+ response = client.all_policies.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
- filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
)
for item in response:
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementAllPolicies.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_apply_network_configuration_updates.py
index 9c0913a1103e..47a0e56a5661 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_apply_network_configuration_updates(
@@ -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/2023-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..66eedbfcbaa0 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.begin_create_or_update(
@@ -34,7 +34,7 @@ def main():
service_name="apimService1",
private_endpoint_connection_name="privateEndpointConnectionName",
private_endpoint_connection_request={
- "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName",
+ "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName",
"properties": {
"privateLinkServiceConnectionState": {
"description": "The Private Endpoint Connection is approved.",
@@ -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/2023-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..edfb3110acc6 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.list_secrets(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementAuthorizationServerListSecrets.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..4f570817c09d 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
@@ -26,17 +26,16 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.backend.reconnect(
+ client.backend.reconnect(
resource_group_name="rg1",
service_name="apimService1",
backend_id="proxybackend",
)
- 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/2023-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..9bc23dfcada2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_backup(
@@ -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/2023-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..e06434374b2d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_backup(
@@ -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/2023-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..fbd8e7164af5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_backup(
@@ -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/2023-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..11a50ab04107 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.create_or_update(
@@ -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/2023-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..0df4e1e5282d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -50,6 +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/2023-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..e62902643d41 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -41,7 +41,7 @@ def main():
"path": "echo2",
"protocols": ["http", "https"],
"serviceUrl": "http://echoapi.cloudapp.net/api",
- "sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001",
+ "sourceApiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001",
"subscriptionRequired": True,
}
},
@@ -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/2023-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..78088ed2e57b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.create_or_update(
@@ -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/2023-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..f1001302ece1 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.create_or_update(
@@ -40,13 +40,13 @@ def main():
"description": "New API issue description",
"state": "open",
"title": "New API issue",
- "userId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1",
+ "userId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1",
}
},
)
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiIssue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..1a30db4d0aba 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_attachment.create_or_update(
@@ -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/2023-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..60c3d50a0578 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_comment.create_or_update(
@@ -39,13 +39,13 @@ def main():
"properties": {
"createdDate": "2018-02-01T22:21:20.467Z",
"text": "Issue comment.",
- "userId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1",
+ "userId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1",
}
},
)
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiIssueComment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..65abe48707ba 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -36,14 +36,14 @@ def main():
parameters={
"properties": {
"apiVersion": "v4",
- "apiVersionSetId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
+ "apiVersionSetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
"description": "Create Echo API into a new Version using Existing Version Set and Copy all Operations.",
"displayName": "Echo API2",
"isCurrent": True,
"path": "echo2",
"protocols": ["http", "https"],
"serviceUrl": "http://echoapi.cloudapp.net/api",
- "sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath",
+ "sourceApiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath",
"subscriptionRequired": True,
}
},
@@ -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/2023-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..18d7e8c4acde 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.create_or_update(
@@ -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/2023-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..4643b04fffaa 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation_policy.create_or_update(
@@ -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/2023-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..5ffa3348b87e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.assign_to_operation(
@@ -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/2023-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..4644725bd6ea 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.create_or_update(
@@ -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/2023-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..7b32c65a11a5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.create_or_update(
@@ -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/2023-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..ef143a83bcf2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.create_or_update(
@@ -36,7 +36,7 @@ def main():
release_id="testrev",
parameters={
"properties": {
- "apiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
"notes": "yahooagain",
}
},
@@ -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/2023-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..cb4db8632e3b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -38,13 +38,13 @@ def main():
"apiRevisionDescription": "Creating a Revision of an existing API",
"path": "echo",
"serviceUrl": "http://echoapi.cloudapp.net/apiv3",
- "sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api",
+ "sourceApiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api",
}
},
).result()
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..9f956cfe1e9f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_schema.begin_create_or_update(
@@ -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/2023-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..15cd8acd711c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.assign_to_api(
@@ -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/2023-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..36d6507e6c4b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_tag_description.create_or_update(
@@ -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/2023-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..2689ab27cd99 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -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/2023-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..337349619920 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -44,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/2023-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..f40e4c1f1b0a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -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/2023-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..a5ca8aacb9d7 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -44,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/2023-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..14c5fddd9270 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -44,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/2023-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..49cc0bfd4afb 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.create_or_update(
@@ -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/2023-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..c755bf5daf9f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wiki.create_or_update(
@@ -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/2023-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..ef1b726bcc50 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -53,6 +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/2023-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..12c8f8827cd8 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -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/2023-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..51212dc62c62 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -50,6 +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/2023-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..167fb7b7f50f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.create_or_update(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateAuthorizationAADAuthCode.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f8a66cc897c5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.create_or_update(
@@ -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/2023-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..8ae38660e853 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_access_policy.create_or_update(
@@ -37,6 +37,7 @@ def main():
authorization_access_policy_id="fe0bed83-631f-4149-bd0b-0464b1bc7cab",
parameters={
"properties": {
+ "appIds": ["d5f04bb0-ba78-4878-a43e-35a0b74fe315"],
"objectId": "fe0bed83-631f-4149-bd0b-0464b1bc7cab",
"tenantId": "13932a0d-5c63-4d37-901d-1df9c97722ff",
}
@@ -45,6 +46,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/2023-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..2b2cec7d7691 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.create_or_update(
@@ -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/2023-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..166e5c1d2584 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.create_or_update(
@@ -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/2023-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..3e3937f9cf9f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.create_or_update(
@@ -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/2023-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..0ca35202d863 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.create_or_update(
@@ -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/2023-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..461091fa4c5b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.create_or_update(
@@ -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/2023-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..aae33ab84ca3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.create_or_update(
@@ -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/2023-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..12fbb8d59556 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.create_or_update(
@@ -38,7 +38,7 @@ def main():
"description": "Service Fabric Test App 1",
"properties": {
"serviceFabricCluster": {
- "clientCertificateId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1",
+ "clientCertificateId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1",
"managementEndpoints": ["https://somecluster.com"],
"maxPartitionResolutionRetries": 5,
"serverX509Names": [
@@ -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/2023-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..b8799daa7164 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.create_or_update(
@@ -37,7 +37,7 @@ def main():
"properties": {
"connectionString": "apim.redis.cache.windows.net:6380,password=xc,ssl=True,abortConnect=False",
"description": "Redis cache instances in West India",
- "resourceId": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1",
+ "resourceId": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1",
"useFromLocation": "default",
}
},
@@ -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/2023-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..83a6168d1f79 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.create_or_update(
@@ -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/2023-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..e2c060e5d98b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.create_or_update(
@@ -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/2023-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..2275755e8305 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_type.create_or_update(
@@ -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/2023-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..fb51f7ff262a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_item.create_or_update(
@@ -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/2023-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..dce9d89092f7 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.create_or_update(
@@ -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/2023-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..b36de564c657 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.documentation.create_or_update(
@@ -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/2023-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..f342d2406dee 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.create_or_update(
@@ -47,6 +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/2023-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..664a7c7066ec 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.create_or_update(
@@ -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/2023-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..9652252a3e6e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_api.create_or_update(
@@ -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/2023-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..f32df9f912a5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_certificate_authority.create_or_update(
@@ -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/2023-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..8e045b3a8ed8 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_hostname_configuration.create_or_update(
@@ -36,7 +36,7 @@ def main():
hc_id="default",
parameters={
"properties": {
- "certificateId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1",
+ "certificateId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1",
"hostname": "*",
"http2Enabled": True,
"negotiateClientCertificate": False,
@@ -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/2023-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..b7575286763e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.begin_create_or_update(
@@ -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/2023-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..cd6b9b752bcb 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.begin_create_or_update(
@@ -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/2023-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..40a25a17d106 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -47,6 +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/2023-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..f408f32783d3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.create_or_update(
@@ -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/2023-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..a38c9fe60710 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver_policy.create_or_update(
@@ -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/2023-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..e51b3089236f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.create_or_update(
@@ -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/2023-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..d423d900cb34 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.create_or_update(
@@ -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/2023-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..c99ce92b5172 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group_user.create(
@@ -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/2023-09-01-preview/examples/ApiManagementCreateGroupUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_grpc_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_grpc_api.py
new file mode 100644
index 000000000000..a71b2a4d075c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_grpc_api.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_grpc_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ api_id="tempgroup",
+ parameters={
+ "properties": {
+ "description": "apidescription5200",
+ "displayName": "apiname1463",
+ "format": "grpc-link",
+ "path": "grpc-api",
+ "protocols": ["https"],
+ "serviceUrl": "https://your-api-hostname/samples",
+ "type": "grpc",
+ "value": "https://raw.githubusercontent.com/kedacore/keda/main/pkg/scalers/externalscaler/externalscaler.proto",
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementCreateGrpcApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_identity_provider.py
index f11cfccf08ba..eb9e623b90e0 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.create_or_update(
@@ -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/2023-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..000072af466e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -59,6 +59,12 @@ def main():
"hostName": "portal1.msitesting.net",
"type": "Portal",
},
+ {
+ "certificatePassword": "Password",
+ "encodedCertificate": "****** Base 64 Encoded Certificate ************",
+ "hostName": "configuration-api.msitesting.net",
+ "type": "ConfigurationApi",
+ },
],
"publisherEmail": "apim@autorestsdk.com",
"publisherName": "autorestsdk",
@@ -71,6 +77,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/2023-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..7a58e463f825 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.begin_create_or_update(
@@ -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/2023-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..4aa5f4de709c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.begin_create_or_update(
@@ -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/2023-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..57c82cddfe37 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification.create_or_update(
@@ -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/2023-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..361e2ed66245 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_email.create_or_update(
@@ -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/2023-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..b0cf5345218c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_user.create_or_update(
@@ -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/2023-09-01-preview/examples/ApiManagementCreateNotificationRecipientUser.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_odata_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_odata_api.py
new file mode 100644
index 000000000000..08cf09609769
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_odata_api.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_odata_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ api_id="tempgroup",
+ parameters={
+ "properties": {
+ "description": "apidescription5200",
+ "displayName": "apiname1463",
+ "format": "odata-link",
+ "path": "odata-api",
+ "protocols": ["http", "https"],
+ "serviceUrl": "https://services.odata.org/TripPinWebApiService",
+ "type": "odata",
+ "value": "https://services.odata.org/TripPinWebApiService/$metadata",
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementCreateODataApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_open_id_connect_provider.py
index 792c44aa500a..641b4aba371f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.create_or_update(
@@ -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/2023-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..16c853de8d73 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.create_or_update(
@@ -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/2023-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..c56f9cdb4052 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.begin_create_or_update(
@@ -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/2023-09-01-preview/examples/ApiManagementCreatePolicyFragment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_restriction.py
new file mode 100644
index 000000000000..d2f0c72c41c6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_policy_restriction.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_create_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ parameters={"properties": {"requireBase": "true", "scope": "Sample Path to the policy document."}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementCreatePolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_portal_config.py
index 4476b4d39569..be522cdaf7ff 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.create_or_update(
@@ -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/2023-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..899bb6478467 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.begin_create_or_update(
@@ -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/2023-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..c8f84e64aef5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.create_or_update(
@@ -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/2023-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..9e9834d3e134 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_api.create_or_update(
@@ -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/2023-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..bdc9281b92d9
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_api_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ api_link_id="link1",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..cc40d6c5c76a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_group.create_or_update(
@@ -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/2023-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..2424481abc98
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_group_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ group_link_id="link1",
+ parameters={
+ "properties": {
+ "groupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/group1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..8a2b26aa57d9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_policy.create_or_update(
@@ -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/2023-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..8ae9afedab7f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.assign_to_product(
@@ -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/2023-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..3c25b72d9143 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wiki.create_or_update(
@@ -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/2023-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..d1b0683eef22 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -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/2023-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..1df03c37fb7d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -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/2023-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..c8e4bc633d0d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -35,11 +35,11 @@ def main():
parameters={
"location": "East US 2 EUAP",
"properties": {
- "publicIpAddressId": "/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/apimazvnet",
+ "publicIpAddressId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName/providers/Microsoft.Network/publicIPAddresses/apimazvnet",
"publisherEmail": "apim@autorestsdk.com",
"publisherName": "autorestsdk",
"virtualNetworkConfiguration": {
- "subnetResourceId": "/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/apimcus/subnets/tenant"
+ "subnetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/apimcus/subnets/tenant"
},
"virtualNetworkType": "External",
},
@@ -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/2023-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..bb209be161e6 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -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/2023-09-01-preview/examples/ApiManagementCreateServiceInZones.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_skuv2_service.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_skuv2_service.py
new file mode 100644
index 000000000000..fd3eb9a3c34c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_skuv2_service.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_service_skuv2_service.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_management_service.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ parameters={
+ "identity": {"type": "SystemAssigned"},
+ "location": "West US",
+ "properties": {"publisherEmail": "apim@autorestsdk.com", "publisherName": "autorestsdk"},
+ "sku": {"capacity": 1, "name": "StandardV2"},
+ "tags": {"tag1": "value1", "tag2": "value2", "tag3": "value3"},
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementCreateServiceSkuv2Service.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_custom_hostname_key_vault.py
index 581cc7c4ff4b..a07b830a39aa 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -36,7 +36,7 @@ def main():
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
- "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}
+ "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}
},
},
"location": "North Europe",
@@ -62,6 +62,12 @@ def main():
"keyVaultId": "https://rpbvtkeyvaultintegration.vault.azure.net/secrets/msitestingCert",
"type": "Portal",
},
+ {
+ "certificatePassword": "Password",
+ "encodedCertificate": "****** Base 64 Encoded Certificate ************",
+ "hostName": "configuration-api.msitesting.net",
+ "type": "ConfigurationApi",
+ },
],
"publisherEmail": "apim@autorestsdk.com",
"publisherName": "autorestsdk",
@@ -74,6 +80,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/2023-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_developer_portal.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_developer_portal.py
new file mode 100644
index 000000000000..edb6285a8fab
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_developer_portal.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_service_with_developer_portal.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_management_service.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ parameters={
+ "location": "South Central US",
+ "properties": {
+ "developerPortalStatus": "Enabled",
+ "publisherEmail": "foo@contoso.com",
+ "publisherName": "foo",
+ },
+ "sku": {"capacity": 1, "name": "Developer"},
+ "tags": {"Name": "Contoso", "Test": "User"},
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementCreateServiceWithDeveloperPortal.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_with_nat_gateway_enabled.py
index 63ff3831197f..3eb966fd6bbc 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -46,6 +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/2023-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..093fa82ef607 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -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/2023-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..d74f8c812227 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -36,7 +36,7 @@ def main():
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
- "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apimService1": {}
+ "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/apimService1": {}
},
},
"location": "West US",
@@ -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/2023-09-01-preview/examples/ApiManagementCreateServiceWithUserAssignedIdentity.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_without_legacy_configuration_api.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_without_legacy_configuration_api.py
new file mode 100644
index 000000000000..4c4b733035ca
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_service_without_legacy_configuration_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_create_service_without_legacy_configuration_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.api_management_service.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ parameters={
+ "location": "Central US",
+ "properties": {
+ "configurationApi": {"legacyApi": "Disabled"},
+ "publisherEmail": "apim@autorestsdk.com",
+ "publisherName": "autorestsdk",
+ },
+ "sku": {"capacity": 1, "name": "Basic"},
+ "tags": {"tag1": "value1", "tag2": "value2", "tag3": "value3"},
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementCreateServiceWithoutLegacyConfigurationApi.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_create_soap_pass_through_api_using_wsdl_import.py
index 311ded97a5d8..e7ee07b75952 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -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/2023-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..a58b5de50313 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -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/2023-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..98185b508c73 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.create_or_update(
@@ -36,14 +36,14 @@ def main():
parameters={
"properties": {
"displayName": "testsub",
- "ownerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7",
- "scope": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002",
+ "ownerId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7",
+ "scope": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002",
}
},
)
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..ce802595423b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.create_or_update(
@@ -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/2023-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..f0648af68447
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_api_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ api_link_id="link1",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..8a9d30cc88b6
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_operation_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ parameters={
+ "properties": {
+ "operationId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/operations/op1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..d9b1bf16448d
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_product_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ product_link_id="link1",
+ parameters={
+ "properties": {
+ "productId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/product1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..268b513d76bd 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.create_or_update(
@@ -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/2023-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..e020c54b11bb 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.create(
@@ -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/2023-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..cbe4dc29f59f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.create_or_update(
@@ -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/2023-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..3746ba7a37a8 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.begin_create_or_update(
@@ -47,6 +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/2023-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..7f8e6f20aff8
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ parameters={"properties": {"description": "workspace 1", "displayName": "my workspace"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..9471e7ef2de4
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="tempgroup",
+ parameters={
+ "properties": {
+ "authenticationSettings": {
+ "oAuth2": {"authorizationServerId": "authorizationServerId2283", "scope": "oauth2scope2580"}
+ },
+ "description": "apidescription5200",
+ "displayName": "apiname1463",
+ "path": "newapiPath",
+ "protocols": ["https", "http"],
+ "serviceUrl": "http://newechoapi.cloudapp.net/api",
+ "subscriptionKeyParameterNames": {"header": "header4520", "query": "query3037"},
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..20761c24a5ba
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="PetStoreTemplate2",
+ operation_id="newoperations",
+ parameters={
+ "properties": {
+ "description": "This can only be done by the logged in user.",
+ "displayName": "createUser2",
+ "method": "POST",
+ "request": {
+ "description": "Created user object",
+ "headers": [],
+ "queryParameters": [],
+ "representations": [
+ {"contentType": "application/json", "schemaId": "592f6c1d0af5840ca8897f0c", "typeName": "User"}
+ ],
+ },
+ "responses": [
+ {
+ "description": "successful operation",
+ "headers": [],
+ "representations": [{"contentType": "application/xml"}, {"contentType": "application/json"}],
+ "statusCode": 200,
+ }
+ ],
+ "templateParameters": [],
+ "urlTemplate": "/user1",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..386d8896bff7
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b57e7e8880006a040001",
+ operation_id="5600b57e7e8880006a080001",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "xml",
+ "value": " ",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..e7b5f7a4c307
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b57e7e8880006a040001",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "xml",
+ "value": " ",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..aa9c800439e7
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_release.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="a1",
+ release_id="testrev",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/a1",
+ "notes": "yahooagain",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..8f3c7b4106d3
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_schema.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="59d6bb8f1f7fab13dc67ec9b",
+ schema_id="ec12520d-9d48-4e7b-8f39-698ca2ac63f1",
+ parameters={
+ "properties": {
+ "contentType": "application/vnd.ms-azure-apim.xsd+xml",
+ "document": {
+ "value": '\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n'
+ },
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..ef31378defa6
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="api1",
+ parameters={
+ "properties": {
+ "description": "Version configuration",
+ "displayName": "api set 1",
+ "versioningScheme": "Segment",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..6032793e5659
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="tempgroup",
+ parameters={"properties": {"displayName": "temp group"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..455f1ed2fdfa
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="aadGroup",
+ parameters={
+ "properties": {
+ "description": "new group to test",
+ "displayName": "NewGroup (samiraad.onmicrosoft.com)",
+ "externalId": "aad://samiraad.onmicrosoft.com/groups/83cf2753-5831-4675-bc0e-2f8dc067c58d",
+ "type": "external",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..e06849688a3b
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group_user.create(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="tempgroup",
+ user_id="59307d350af58404d8a26300",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..ad0d2398dd63
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop2",
+ parameters={
+ "properties": {"displayName": "prop3name", "secret": False, "tags": ["foo", "bar"], "value": "propValue"}
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..58ed3e92e780
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop6",
+ parameters={
+ "properties": {
+ "displayName": "prop6namekv",
+ "keyVault": {
+ "identityClientId": "ceaa6b06-c00f-43ef-99ac-f53d1fe876a0",
+ "secretIdentifier": "https://contoso.vault.azure.net/secrets/aadSecret",
+ },
+ "secret": True,
+ "tags": ["foo", "bar"],
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..78b0563af6fe
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..472e6b200626
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_email.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ email="foobar@live.com",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..d7afcdb48c25
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_user.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ user_id="576823d0a40f7e74ec07d642",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..d135f0151f8f
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "xml",
+ "value": " ",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..bf59991304ae
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ parameters={
+ "properties": {
+ "description": "A policy fragment example",
+ "format": "xml",
+ "value": '',
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..706989fd58ef
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "rawxml",
+ "value": '\r\n \r\n \r\n \r\n "@(context.Request.Headers.FirstOrDefault(h => h.Ke=="Via"))" \r\n \r\n \r\n ',
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..373f882c9fbe
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ parameters={"properties": {"displayName": "Test Template ProductName 4"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..95a592e480bb
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_api_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ api_link_id="link1",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..53797056315d
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_group_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ group_link_id="link1",
+ parameters={
+ "properties": {
+ "groupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/groups/group1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..43cd32bf5f86
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_policy.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="5702e97e5157a50f48dce801",
+ policy_id="policy",
+ parameters={
+ "properties": {
+ "format": "xml",
+ "value": '\r\n \r\n \r\n \r\n @( string.Join(",", DateTime.UtcNow, context.Deployment.ServiceName, context.RequestId, context.Request.IpAddress, context.Operation.Name) ) \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..c1c33132ab3a
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_global_schema.begin_create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ schema_id="schema1",
+ parameters={
+ "properties": {
+ "description": "sample schema description",
+ "schemaType": "xml",
+ "value": '\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',
+ }
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..cd106b728ba3
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ parameters={
+ "properties": {
+ "displayName": "testsub",
+ "ownerId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7",
+ "scope": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/products/5600b59475ff190048060002",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..3ce63a99cc5c
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tagId1",
+ parameters={"properties": {"displayName": "tag1"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..e7367f6fa516
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_api_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ api_link_id="link1",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..cb526da1e38a
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_operation_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ parameters={
+ "properties": {
+ "operationId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/echo-api/operations/op1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..e19f42760deb
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_product_link.create_or_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ product_link_id="link1",
+ parameters={
+ "properties": {
+ "productId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/products/product1"
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..9f2e3428b69c 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api.delete(
+ client.api.begin_delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="echo-api",
if_match="*",
- )
- print(response)
+ ).result()
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..35a936d0f0e9 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_diagnostic.delete(
+ client.api_diagnostic.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="57d1f7558aa04f15146d9d8a",
diagnostic_id="applicationinsights",
if_match="*",
)
- 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/2023-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..6e6f320ef203 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_issue.delete(
+ client.api_issue.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="57d1f7558aa04f15146d9d8a",
issue_id="57d2ef278aa04f0ad01d6cdc",
if_match="*",
)
- 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/2023-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..a0f0ec2b7f0b 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
@@ -26,10 +26,10 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_issue_attachment.delete(
+ client.api_issue_attachment.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="57d1f7558aa04f15146d9d8a",
@@ -37,9 +37,8 @@ def main():
attachment_id="57d2ef278aa04f0888cba3f3",
if_match="*",
)
- 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/2023-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..ae368fcecdd5 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
@@ -26,10 +26,10 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_issue_comment.delete(
+ client.api_issue_comment.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="57d1f7558aa04f15146d9d8a",
@@ -37,9 +37,8 @@ def main():
comment_id="599e29ab193c3c0bd0b3e2fb",
if_match="*",
)
- 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/2023-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..6935e8e07d00 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_operation.delete(
+ client.api_operation.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="57d2ef278aa04f0888cba3f3",
operation_id="57d2ef278aa04f0ad01d6cdc",
if_match="*",
)
- 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/2023-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..70341fe4090b 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
@@ -26,10 +26,10 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_operation_policy.delete(
+ client.api_operation_policy.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="testapi",
@@ -37,9 +37,8 @@ def main():
policy_id="policy",
if_match="*",
)
- 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/2023-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..b389a2896d6f 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.tag.detach_from_operation(
+ client.tag.detach_from_operation(
resource_group_name="rg1",
service_name="apimService1",
api_id="59d5b28d1f7fab116c282650",
operation_id="59d5b28d1f7fab116c282651",
tag_id="59d5b28e1f7fab116402044e",
)
- 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/2023-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..205ee00450bf 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_policy.delete(
+ client.api_policy.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="loggerId",
policy_id="policy",
if_match="*",
)
- 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/2023-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..b5231159f85a 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_release.delete(
+ client.api_release.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="5a5fcc09124a7fa9b89f2f1d",
release_id="testrev",
if_match="*",
)
- 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/2023-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..f3e7b8e9d910 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_schema.delete(
+ client.api_schema.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="59d5b28d1f7fab116c282650",
schema_id="59d5b28e1f7fab116402044e",
if_match="*",
)
- 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/2023-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..2a66010aa88f 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.tag.detach_from_api(
+ client.tag.detach_from_api(
resource_group_name="rg1",
service_name="apimService1",
api_id="59d5b28d1f7fab116c282650",
tag_id="59d5b28e1f7fab116402044e",
)
- 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/2023-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..05f3682bc223 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_tag_description.delete(
+ client.api_tag_description.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="59d5b28d1f7fab116c282650",
tag_description_id="59d5b28e1f7fab116402044e",
if_match="*",
)
- 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/2023-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..5dd8a215d7d9 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_version_set.delete(
+ client.api_version_set.delete(
resource_group_name="rg1",
service_name="apimService1",
version_set_id="a1",
if_match="*",
)
- 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/2023-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..035a92419b42 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.api_wiki.delete(
+ client.api_wiki.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="57d1f7558aa04f15146d9d8a",
if_match="*",
)
- 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/2023-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..0f96d14d200e 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.authorization.delete(
+ client.authorization.delete(
resource_group_name="rg1",
service_name="apimService1",
authorization_provider_id="aadwithauthcode",
authorization_id="authz1",
if_match="*",
)
- 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/2023-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..c221172c9625 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
@@ -26,10 +26,10 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.authorization_access_policy.delete(
+ client.authorization_access_policy.delete(
resource_group_name="rg1",
service_name="apimService1",
authorization_provider_id="aadwithauthcode",
@@ -37,9 +37,8 @@ def main():
authorization_access_policy_id="fe0bed83-631f-4149-bd0b-0464b1bc7cab",
if_match="*",
)
- 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/2023-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..c02a9231af8f 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.authorization_provider.delete(
+ client.authorization_provider.delete(
resource_group_name="rg1",
service_name="apimService1",
authorization_provider_id="aadwithauthcode",
if_match="*",
)
- 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/2023-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..01c04df378b8 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.authorization_server.delete(
+ client.authorization_server.delete(
resource_group_name="rg1",
service_name="apimService1",
authsid="newauthServer2",
if_match="*",
)
- 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/2023-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..02ac8b6342ae 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.backend.delete(
+ client.backend.delete(
resource_group_name="rg1",
service_name="apimService1",
backend_id="sfbackend",
if_match="*",
)
- 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/2023-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..e079c426549b 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.cache.delete(
+ client.cache.delete(
resource_group_name="rg1",
service_name="apimService1",
cache_id="southindia",
if_match="*",
)
- 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/2023-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..ef73a7d19ac7 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.certificate.delete(
+ client.certificate.delete(
resource_group_name="rg1",
service_name="apimService1",
certificate_id="tempcert",
if_match="*",
)
- 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/2023-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..65203e946535 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.content_type.delete(
+ client.content_type.delete(
resource_group_name="rg1",
service_name="apimService1",
content_type_id="page",
if_match="*",
)
- 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/2023-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..e1c0a2c95b0c 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.content_item.delete(
+ client.content_item.delete(
resource_group_name="rg1",
service_name="apimService1",
content_type_id="page",
content_item_id="4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8",
if_match="*",
)
- 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/2023-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..85b576c95633 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.diagnostic.delete(
+ client.diagnostic.delete(
resource_group_name="rg1",
service_name="apimService1",
diagnostic_id="applicationinsights",
if_match="*",
)
- 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/2023-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..09587fc31ab4 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.gateway.delete(
+ client.gateway.delete(
resource_group_name="rg1",
service_name="apimService1",
gateway_id="gw1",
if_match="*",
)
- 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/2023-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..690659ba35c8 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.gateway_api.delete(
+ client.gateway_api.delete(
resource_group_name="rg1",
service_name="apimService1",
gateway_id="gw1",
api_id="echo-api",
)
- 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/2023-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..6e3618aec339 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.gateway_certificate_authority.delete(
+ client.gateway_certificate_authority.delete(
resource_group_name="rg1",
service_name="apimService1",
gateway_id="gw1",
certificate_id="default",
if_match="*",
)
- 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/2023-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..bd9d7a5abca8 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.gateway_hostname_configuration.delete(
+ client.gateway_hostname_configuration.delete(
resource_group_name="rg1",
service_name="apimService1",
gateway_id="gw1",
hc_id="default",
if_match="*",
)
- 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/2023-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..1a9354c07539 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.global_schema.delete(
+ client.global_schema.delete(
resource_group_name="rg1",
service_name="apimService1",
schema_id="schema1",
if_match="*",
)
- 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/2023-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..b2897af87b25 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.graph_ql_api_resolver.delete(
+ client.graph_ql_api_resolver.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="57d2ef278aa04f0888cba3f3",
resolver_id="57d2ef278aa04f0ad01d6cdc",
if_match="*",
)
- 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/2023-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..612c67c804d5 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
@@ -26,10 +26,10 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.graph_ql_api_resolver_policy.delete(
+ client.graph_ql_api_resolver_policy.delete(
resource_group_name="rg1",
service_name="apimService1",
api_id="testapi",
@@ -37,9 +37,8 @@ def main():
policy_id="policy",
if_match="*",
)
- 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/2023-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..607166e52381 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.group.delete(
+ client.group.delete(
resource_group_name="rg1",
service_name="apimService1",
group_id="aadGroup",
if_match="*",
)
- 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/2023-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..1b85948f136e 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.group_user.delete(
+ client.group_user.delete(
resource_group_name="rg1",
service_name="apimService1",
group_id="templategroup",
user_id="59307d350af58404d8a26300",
)
- 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/2023-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..8c7e98ad5d45 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.identity_provider.delete(
+ client.identity_provider.delete(
resource_group_name="rg1",
service_name="apimService1",
identity_provider_name="aad",
if_match="*",
)
- 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/2023-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..898c4276478c 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.logger.delete(
+ client.logger.delete(
resource_group_name="rg1",
service_name="apimService1",
logger_id="loggerId",
if_match="*",
)
- 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/2023-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..b39f201f7055 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.named_value.delete(
+ client.named_value.delete(
resource_group_name="rg1",
service_name="apimService1",
named_value_id="testprop2",
if_match="*",
)
- 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/2023-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..64fd534dc8ef 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.notification_recipient_email.delete(
+ client.notification_recipient_email.delete(
resource_group_name="rg1",
service_name="apimService1",
notification_name="RequestPublisherNotificationMessage",
email="contoso@live.com",
)
- 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/2023-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..622777d6f253 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.notification_recipient_user.delete(
+ client.notification_recipient_user.delete(
resource_group_name="rg1",
service_name="apimService1",
notification_name="RequestPublisherNotificationMessage",
user_id="576823d0a40f7e74ec07d642",
)
- 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/2023-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..da6e20f98077 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.open_id_connect_provider.delete(
+ client.open_id_connect_provider.delete(
resource_group_name="rg1",
service_name="apimService1",
opid="templateOpenIdConnect3",
if_match="*",
)
- 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/2023-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..687fe50ef5c2 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.policy.delete(
+ client.policy.delete(
resource_group_name="rg1",
service_name="apimService1",
policy_id="policy",
if_match="*",
)
- 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/2023-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..6569379df3ee 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.policy_fragment.delete(
+ client.policy_fragment.delete(
resource_group_name="rg1",
service_name="apimService1",
id="policyFragment1",
if_match="*",
)
- 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/2023-09-01-preview/examples/ApiManagementDeletePolicyFragment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_restriction.py
new file mode 100644
index 000000000000..52a7cdbe3474
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_policy_restriction.py
@@ -0,0 +1,41 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.policy_restriction.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementDeletePolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_private_endpoint_connection.py
index 657cd5cc11da..daf2d0e52102 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
@@ -26,17 +26,16 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.private_endpoint_connection.begin_delete(
+ client.private_endpoint_connection.begin_delete(
resource_group_name="rg1",
service_name="apimService1",
private_endpoint_connection_name="privateEndpointConnectionName",
).result()
- 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/2023-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..b7d77191338f 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.product.delete(
+ client.product.delete(
resource_group_name="rg1",
service_name="apimService1",
product_id="testproduct",
if_match="*",
)
- 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/2023-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..83328780240d 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.product_api.delete(
+ client.product_api.delete(
resource_group_name="rg1",
service_name="apimService1",
product_id="testproduct",
api_id="echo-api",
)
- 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/2023-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..0c925362b0b4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_api_link.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_product_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.product_api_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ api_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..17adab065a56 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.product_group.delete(
+ client.product_group.delete(
resource_group_name="rg1",
service_name="apimService1",
product_id="testproduct",
group_id="templateGroup",
)
- 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/2023-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..b28d63646b06
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_product_group_link.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_product_group_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.product_group_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ group_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a10d13cb73d9 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.product_policy.delete(
+ client.product_policy.delete(
resource_group_name="rg1",
service_name="apimService1",
product_id="testproduct",
policy_id="policy",
if_match="*",
)
- 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/2023-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..8d15444c9579 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.tag.detach_from_product(
+ client.tag.detach_from_product(
resource_group_name="rg1",
service_name="apimService1",
product_id="59d5b28d1f7fab116c282650",
tag_id="59d5b28e1f7fab116402044e",
)
- 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/2023-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..12931a0c0ed0 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.product_wiki.delete(
+ client.product_wiki.delete(
resource_group_name="rg1",
service_name="apimService1",
product_id="57d1f7558aa04f15146d9d8a",
if_match="*",
)
- 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/2023-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..fc10cb0f95f8 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.subscription.delete(
+ client.subscription.delete(
resource_group_name="rg1",
service_name="apimService1",
sid="testsub",
if_match="*",
)
- 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/2023-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..9a3f716b9ac8 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.tag.delete(
+ client.tag.delete(
resource_group_name="rg1",
service_name="apimService1",
tag_id="tagId1",
if_match="*",
)
- 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/2023-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..66d5bf796578
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_api_link.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_tag_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.tag_api_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ api_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..956e85f9c0b0
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_operation_link.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_tag_operation_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.tag_operation_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..2ae64451de0c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_tag_product_link.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_delete_tag_product_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.tag_product_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ product_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..b53e7b9222f7 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.email_template.delete(
+ client.email_template.delete(
resource_group_name="rg1",
service_name="apimService1",
template_name="newIssueNotificationMessage",
if_match="*",
)
- 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/2023-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..65ef9618c428 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.user.delete(
+ client.user.begin_delete(
resource_group_name="rg1",
service_name="apimService1",
user_id="5931a75ae4bbd512288c680b",
if_match="*",
- )
- print(response)
+ ).result()
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementDeleteUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..8f5f57967b3d
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_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="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..9aa3a341fd39
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_api.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..c93a3e149feb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_api_operation.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_operation.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ operation_id="57d2ef278aa04f0ad01d6cdc",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..0ff7e2d595dd
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_api_operation_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_operation_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="testapi",
+ operation_id="testoperation",
+ policy_id="policy",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a932af41a30a
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_api_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="loggerId",
+ policy_id="policy",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..b585edcc5fec
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_api_release.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_release.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5a5fcc09124a7fa9b89f2f1d",
+ release_id="testrev",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..89bea271edeb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_api_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_schema.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="59d5b28d1f7fab116c282650",
+ schema_id="59d5b28e1f7fab116402044e",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..16daec06e037
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_api_version_set.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_api_version_set.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="a1",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..169e85bf5ba2
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_group.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_group.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="aadGroup",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..54d5ba657a28
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_group_user.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_group_user.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_group_user.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="templategroup",
+ user_id="59307d350af58404d8a26300",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..686606dd3556
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_named_value.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_named_value.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop2",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementDeleteWorkspaceNamedValue.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_delete_workspace_notification_recipient_email.py
similarity index 74%
rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_time.py
rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_notification_recipient_email.py
index 265f9205ce74..13e884e50f8b 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_delete_workspace_notification_recipient_email.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-import isodate
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
@@ -16,7 +14,7 @@
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
- python api_management_get_reports_by_time.py
+ 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,
@@ -28,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.reports.list_by_time(
+ client.workspace_notification_recipient_email.delete(
resource_group_name="rg1",
service_name="apimService1",
- filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
- interval=isodate.parse_duration("PT15M"),
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ email="contoso@live.com",
)
- for item in response:
- 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/2023-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..3464373a801c
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_notification_recipient_user.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_notification_recipient_user.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_notification_recipient_user.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ user_id="576823d0a40f7e74ec07d642",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..e596ad7cc51e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..87ac2760f5d7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_policy_fragment.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_policy_fragment.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..d9f86dfebe0b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_product.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_product.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..804484818680
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_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_workspace_product_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_product_api_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ api_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..fa0493c82be6
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_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_workspace_product_group_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_product_group_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ group_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..b8853bdcca90
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_product_policy.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_product_policy.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ policy_id="policy",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..73f57d6525d9
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_schema.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_global_schema.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ schema_id="schema1",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..303ef28b80ec
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_subscription.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_subscription.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..00692bcc9529
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_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_delete_workspace_tag.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_tag.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tagId1",
+ if_match="*",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..132f22e7a4d7
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_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_workspace_tag_api_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_tag_api_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ api_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..906f38f55dac
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_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_workspace_tag_operation_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_tag_operation_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..7c15a84acdbb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_delete_workspace_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_workspace_tag_product_link.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_tag_product_link.delete(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ product_link_id="link1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..3d9d9de76eb6 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deleted_services.list_by_subscription()
@@ -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/2023-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..de57f933c57e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deleted_services.begin_purge(
@@ -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/2023-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..1961463299ce 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.generate_token(
@@ -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/2023-09-01-preview/examples/ApiManagementGatewayGenerateToken.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_invalidate_debug_credentials.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_invalidate_debug_credentials.py
new file mode 100644
index 000000000000..402df1d90fe5
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_invalidate_debug_credentials.py
@@ -0,0 +1,41 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_gateway_invalidate_debug_credentials.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.gateway.invalidate_debug_credentials(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ gateway_id="gw1",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementGatewayInvalidateDebugCredentials.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_debug_credentials.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_debug_credentials.py
new file mode 100644
index 000000000000..ffba97cc02b4
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_debug_credentials.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_gateway_list_debug_credentials.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.gateway.list_debug_credentials(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ gateway_id="gw1",
+ parameters={
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
+ "credentialsExpireAfter": "PT1H",
+ "purposes": ["tracing"],
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementGatewayListDebugCredentials.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_keys.py
index b79cc17505ee..2eb400a0c8ff 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.list_keys(
@@ -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/2023-09-01-preview/examples/ApiManagementGatewayListKeys.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_trace.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_trace.py
new file mode 100644
index 000000000000..a67178808207
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_list_trace.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_gateway_list_trace.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.gateway.list_trace(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ gateway_id="gw1",
+ parameters={"traceId": "CrDvXXXXXXXXXXXXXVU3ZA2-1"},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementGatewayListTrace.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_gateway_regenerate_key.py
index 3fdbe8cdf7b9..64a6a2e66640 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.gateway.regenerate_key(
+ client.gateway.regenerate_key(
resource_group_name="rg1",
service_name="apimService1",
gateway_id="gwId",
parameters={"keyType": "primary"},
)
- 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/2023-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..203399a6061f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.get(
@@ -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/2023-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..9451606deba0 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..3fde9cd26f29 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_export.get(
@@ -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/2023-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..ed3faa77344c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_export.get(
@@ -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/2023-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..99f515978922 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiIssue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..da2d60b2d269 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_attachment.get(
@@ -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/2023-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..c6253f616181 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_comment.get(
@@ -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/2023-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..9a11d33454a1 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.get(
@@ -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/2023-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..ce0ef08f0636 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.get(
@@ -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/2023-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..27fa18c655e8 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation_policy.get(
@@ -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/2023-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..f754da8bb4c1 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_by_operation(
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiOperationTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..785d15aa8179 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.get(
@@ -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/2023-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..fd0f10155983 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.get(
@@ -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/2023-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..c62d67a7b314 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.get(
@@ -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/2023-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..8c6453f86779 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_schema.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiSchema.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a8e90b31a741 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_by_api(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetApiTag.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..3ee92d547562 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_tag_description.get(
@@ -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/2023-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..4c23970a7793 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.get(
@@ -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/2023-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..b986f6e76191 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wiki.get(
@@ -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/2023-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..789dc4c06356 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.get(
@@ -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/2023-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..40eb95634694 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_access_policy.get(
@@ -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/2023-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..58ff87e5e4a6 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_login_links.post(
@@ -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/2023-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..f7c91a50f6eb 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.get(
@@ -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/2023-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..f7312b18ef88 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.get(
@@ -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/2023-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..d87cb6467da9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.get(
@@ -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/2023-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..e68dbfcd9e0c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.get(
@@ -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/2023-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..2f0ba6815183 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.get(
@@ -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/2023-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..f9af0f0b5820 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.get(
@@ -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/2023-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..705d78bb263d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_type.get(
@@ -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/2023-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..e33d16004e49 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_item.get(
@@ -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/2023-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..f0e00ad557e7 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deleted_services.get_by_name(
@@ -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/2023-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..46edd75792d4 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.get(
@@ -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/2023-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..fd0e2ed51cc3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.documentation.get(
@@ -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/2023-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..b79c335c309d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.get(
@@ -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/2023-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..c349e180da90 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_certificate_authority.get(
@@ -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/2023-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..614e54ccc69f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_hostname_configuration.get(
@@ -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/2023-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..31e00da1bc3f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.get(
@@ -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/2023-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..450c914c1dfc 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.get(
@@ -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/2023-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..fc8ff78e2936 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.get(
@@ -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/2023-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..69f31fdaf3e2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver_policy.get(
@@ -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/2023-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..e2a169a74d0f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.get(
@@ -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/2023-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..93ed55869f2d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.get(
@@ -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/2023-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..2f8eb68d6da5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.issue.get(
@@ -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/2023-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..27c195803716 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.get(
@@ -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/2023-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..997f985e90d9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.get(
@@ -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/2023-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..cac04102a9ea 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.get(
@@ -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/2023-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..b7d746d4ce1c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification.get(
@@ -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/2023-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..1fe731d6a21b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.get(
@@ -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/2023-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..32f1d3663682 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.get(
@@ -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/2023-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..70f74017ea79 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.get(
@@ -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/2023-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..5a916f960c23 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.get(
@@ -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/2023-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..02c3b86eea2c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.get(
@@ -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/2023-09-01-preview/examples/ApiManagementGetPolicyFragmentFormat.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_restriction.py
new file mode 100644
index 000000000000..9da6c46c35fa
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_policy_restriction.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_get_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementGetPolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_portal_revision.py
index ca15c2610f31..18f48f21dc08 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.get(
@@ -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/2023-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..bd3ec8126fa3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.get_by_name(
@@ -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/2023-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..7b44665c872b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.get_private_link_resource(
@@ -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/2023-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..4ff458017510 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.get(
@@ -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/2023-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..dbeab71f4f9d
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_api_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ api_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..7e1a8fdef958
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.product_group_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ product_id="testproduct",
+ group_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..da7cbbfbc7d4 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_policy.get(
@@ -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/2023-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..3ba9f8f91b3e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_by_product(
@@ -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/2023-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..f969e45b512f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wiki.get(
@@ -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/2023-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..b7e983b69f00 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.quota_by_counter_keys.list_by_service(
@@ -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/2023-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..1f2a526c9f83 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.quota_by_period_keys.get(
@@ -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/2023-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_subscription.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_subscription.py
deleted file mode 100644
index 5f041ecd09f9..000000000000
--- a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_subscription.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# coding=utf-8
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for license information.
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is regenerated.
-# --------------------------------------------------------------------------
-
-from azure.identity import DefaultAzureCredential
-from azure.mgmt.apimanagement import ApiManagementClient
-
-"""
-# PREREQUISITES
- pip install azure-identity
- pip install azure-mgmt-apimanagement
-# USAGE
- python api_management_get_reports_by_subscription.py
-
- Before run the sample, please set the values of the client ID, tenant ID and client secret
- of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
- AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
- https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
-"""
-
-
-def main():
- client = ApiManagementClient(
- credential=DefaultAzureCredential(),
- subscription_id="subid",
- )
-
- response = client.reports.list_by_subscription(
- resource_group_name="rg1",
- service_name="apimService1",
- filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
- )
- for item in response:
- print(item)
-
-
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsBySubscription.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..41dd27c3c879 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.get(
@@ -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/2023-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..be9844370e89 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get(
@@ -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/2023-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..b67439e4d259
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_api_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ api_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..368da4d2cae6
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_operation_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..5d82258b15ee
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_product_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ product_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..fd4982b5225a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.get(
@@ -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/2023-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..525f5022d079 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.get(
@@ -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/2023-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..d246c30cb6f0 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.get(
@@ -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/2023-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..f9bbfceecc30 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_settings.get(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetTenantSettings.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..38569dd91d11 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.get(
@@ -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/2023-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..1b541c955202 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user_subscription.get(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetUserSubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..8f07f3e49233
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f0b6c09a4edf
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f27333873734
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_export.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ format="swagger-link",
+ export="true",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..ea8149e9744a
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_export.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="aid9676",
+ format="openapi-link",
+ export="true",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..98246db7e9b8
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ operation_id="57d2ef278aa04f0ad01d6cdc",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a8991bc7fb2b
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation_policy.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b539c53f5b0062040001",
+ operation_id="5600b53ac53f5b0062080006",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..36cc012efcff
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_policy.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b59475ff190048040001",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..b99353c42a12
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_release.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="a1",
+ release_id="5a7cb545298324c53224a799",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..fdb9b2dc15e4
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api;rev=3",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..9b042410471f
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_schema.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="59d6bb8f1f7fab13dc67ec9b",
+ schema_id="ec12520d-9d48-4e7b-8f39-698ca2ac63f1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..cf3f609c4b74
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="vs1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..7f15af10bda4
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="59306a29e4bbd510dc24e5f9",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..6c3eabbb9eaa
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testarmTemplateproperties2",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..fe518909b6d6
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop6",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..2a7135abb616
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..14d21f55cd48
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a0d90666af01
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..333a689c2df9
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..285c467f4c19
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="unlimited",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..bec1c64fbe4c
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_api_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ api_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a50d480cfedd
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_group_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ group_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..c8efef868334
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_policy.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="kjoshiarmTemplateProduct4",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..7e37b20359b3
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_global_schema.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ schema_id="schema1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..543a14333ba9
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="5931a769d8d14f0ad8ce13b8",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a939e48cc805
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="59306a29e4bbd510dc24e5f9",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..97244e467c77
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_api_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ api_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..30ef98b7d66c
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_operation_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ operation_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..1f1b57616985
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_product_link.get(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ product_link_id="link1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..fa16d05bd7ce 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..23e1de158d72 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..9bd1f6cc1d08 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiIssue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..ae55fbb51088 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_attachment.get_entity_tag(
@@ -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/2023-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..af3a593a27de 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_comment.get_entity_tag(
@@ -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/2023-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..379c0426bdc4 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiOperation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..afa7ce88420a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation_policy.get_entity_tag(
@@ -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/2023-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..ba1a58c51965 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_entity_state_by_operation(
@@ -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/2023-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..5b65e93e63d7 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..62088982f13a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiRelease.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a29ebc3dcc1d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_schema.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiSchema.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..394e39f2bf9a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_entity_state_by_api(
@@ -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/2023-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..deb8f7031bce 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_tag_description.get_entity_tag(
@@ -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/2023-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..99475e2b01ba 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.get_entity_tag(
@@ -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/2023-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..1fa10e0881d8 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wiki.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadApiWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..b96b2dcc9153 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadAuthorizationServer.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f20891d9fd51 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadBackend.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f48617474a33 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadCache.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..649da7c4ee10 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadCertificate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..7dca60cd3260 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_item.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadContentTypeContentItem.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..bffbf5d6029b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.delegation_settings.get_entity_tag(
@@ -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/2023-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..79331e019353 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadDiagnostic.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..8e6b00c3006a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.documentation.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadDocumentation.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..059722550d75 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadEmailTemplate.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f6662bf2dc22 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGateway.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..b019b8778f13 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_api.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGatewayApi.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..761bf3145114 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_certificate_authority.get_entity_tag(
@@ -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/2023-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..0d0a4a65a1de 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_hostname_configuration.get_entity_tag(
@@ -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/2023-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..43af28d15c81 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGlobalSchema.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..5dc4c50f35a6 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.get_entity_tag(
@@ -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/2023-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..ccf9d3ccb6e8 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver_policy.get_entity_tag(
@@ -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/2023-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..5f065af06d17 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadGroup.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..fc2e2cc8dabb 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group_user.check_entity_exists(
@@ -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/2023-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..8dee55d34fd2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadIdentityProvider.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..1e6f1b1ded9f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadLogger.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..245f638b9658 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadNamedValue.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..1ea9a23ca00d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_email.check_entity_exists(
@@ -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/2023-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..02b6581751f9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_user.check_entity_exists(
@@ -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/2023-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..380aa76c0e34 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.get_entity_tag(
@@ -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/2023-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..caf4d9283380 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..9cb829e5583e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadPolicyFragment.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementHeadPolicyFragment.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_restriction.py
new file mode 100644
index 000000000000..4d8b78cd614e
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_policy_restriction.py
@@ -0,0 +1,42 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_head_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementHeadPolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_portal_config.py
index 374abe53354c..0d3906ce2386 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadPortalConfig.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..c946ec995d44 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadPortalRevision.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..1a58e0d541d0 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadProduct.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..43e00f130dca 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_api.check_entity_exists(
@@ -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/2023-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..34bc452d5213 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_group.check_entity_exists(
@@ -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/2023-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..6d50c4c5f1ac 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_policy.get_entity_tag(
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadProductPolicy.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..503f6a6cdd8d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_entity_state_by_product(
@@ -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/2023-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..e87f9e08d244 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wiki.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadProductWiki.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..7d0c5f82c333 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_in_settings.get_entity_tag(
@@ -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/2023-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..aa7ac94b6033 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_up_settings.get_entity_tag(
@@ -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/2023-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..f9d37c4b2080 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadSubscription.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..1271ba1b60af 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.get_entity_state(
@@ -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/2023-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..33c7d3ff5f16 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadTenantAccess.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..fb29f016e562 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.get_entity_tag(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementHeadUser.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..4a8d7f95c560
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..60d3796aa049
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..81d433cd3d23
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ operation_id="57d2ef278aa04f0ad01d6cdc",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..ae575badb55d
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation_policy.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b539c53f5b0062040001",
+ operation_id="5600b53ac53f5b0062080006",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..ac33155c8e64
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_policy.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f32631a5c86c
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_release.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="a1",
+ release_id="5a7cb545298324c53224a799",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..553abadd416c
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_schema.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d1f7558aa04f15146d9d8a",
+ schema_id="ec12520d-9d48-4e7b-8f39-698ca2ac63f1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..d6ec5c209d5a
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="vs1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..bdfd778d700e
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="59306a29e4bbd510dc24e5f9",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..899b528d9969
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group_user.check_entity_exists(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="59306a29e4bbd510dc24e5f9",
+ user_id="5931a75ae4bbd512a88c680b",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..0e629f44ceec
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testarmTemplateproperties2",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..58898fd5f576
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_email.check_entity_exists(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ email="contoso@live.com",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..32882732b84d
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_user.check_entity_exists(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ user_id="576823d0a40f7e74ec07d642",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..71ec68b5cec3
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..b6a2a242cf78
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..17ee26382a23
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="unlimited",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..cae63972424e
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_policy.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="unlimited",
+ policy_id="policy",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..eb888b495bd6
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_global_schema.get_entity_tag(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ schema_id="myschema",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementHeadWorkspaceSchema.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_head_workspace_subscription.py
similarity index 77%
rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_request.py
rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_head_workspace_subscription.py
index 3f66b9b7c6f5..966d965b285c 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_head_workspace_subscription.py
@@ -14,7 +14,7 @@
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
- python api_management_get_reports_by_request.py
+ 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,
@@ -26,18 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.reports.list_by_request(
+ response = client.workspace_subscription.get_entity_tag(
resource_group_name="rg1",
service_name="apimService1",
- filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ workspace_id="wks1",
+ sid="5931a769d8d14f0ad8ce13b8",
)
- for item in response:
- print(item)
+ print(response)
-# 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/2023-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..a3ffab4aa75b
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.get_entity_state(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="59306a29e4bbd510dc24e5f9",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..0ab2f0492c64 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.list_secrets(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementIdentityProviderListSecrets.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..ff905c8fc8f7 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiDiagnostics.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f22765c6cad4 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_attachment.list_by_service(
@@ -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/2023-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..02bd0aea5132 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue_comment.list_by_service(
@@ -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/2023-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..74eb6e6d0b4e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiIssues.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..c9bf45f85382 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation_policy.list_by_operation(
@@ -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/2023-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..1147874f99e9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.list_by_operation(
@@ -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/2023-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..1fc5835ac290 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.list_by_api(
@@ -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/2023-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..bf131780351f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.operation.list_by_tags(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiOperationsByTags.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..9164986fca21 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_policy.list_by_api(
@@ -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/2023-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..93c08cc6931f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_product.list_by_apis(
@@ -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/2023-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..3d1ee44a4532 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiReleases.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..37636a8b2e90 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_revision.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListApiRevisions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..5d60d83466b3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_schema.list_by_api(
@@ -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/2023-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..356b6fdec4bb 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_tag_description.list_by_service(
@@ -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/2023-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..f1313e963df8 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.list_by_api(
@@ -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/2023-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..9044ec5dd238 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.list_by_service(
@@ -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/2023-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..d53ced701b5b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wikis.list(
@@ -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/2023-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..4560cf3b5406 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.list_by_service(
@@ -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/2023-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..54f40049acd9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.list_by_tags(
@@ -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/2023-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..dfbab459efc5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_access_policy.list_by_authorization(
@@ -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/2023-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..d68f8e919517 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_provider.list_by_service(
@@ -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/2023-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..cefdabdbe32d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.list_by_service(
@@ -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/2023-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..d3e151cb271f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.list_by_authorization_provider(
@@ -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/2023-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..c469e4c40f09 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization.list_by_authorization_provider(
@@ -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/2023-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..e07f1f2194ab 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.list_by_service(
@@ -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/2023-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..a9c50dbde8bc 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.list_by_service(
@@ -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/2023-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..ec491399a27a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.list_by_service(
@@ -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/2023-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..7dccbf88d0f1 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_item.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListContentTypeContentItems.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..255deb53f496 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_type.list_by_service(
@@ -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/2023-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..1f83938494b8 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.list_by_service(
@@ -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/2023-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..60478769a880 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.documentation.list_by_service(
@@ -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/2023-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..7cb630ad7772 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_api.list_by_service(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListGatewayApis.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a875e2a9d51b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_certificate_authority.list_by_service(
@@ -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/2023-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..2f0af2e9415b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway_hostname_configuration.list_by_service(
@@ -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/2023-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..f67d695d773c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.list_by_service(
@@ -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/2023-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..f09abdc7690c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.global_schema.list_by_service(
@@ -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/2023-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..1858a2c2b474 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver_policy.list_by_resolver(
@@ -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/2023-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..1cc3f4e18167 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.list_by_api(
@@ -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/2023-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..31e7ed0ceea5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group_user.list(
@@ -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/2023-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..c04a538f01e6 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.list_by_service(
@@ -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/2023-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..77bd410f3104 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.list_by_service(
@@ -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/2023-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..e38e1300d8ce 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.issue.list_by_service(
@@ -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/2023-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..98bad233676f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.list_by_service(
@@ -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/2023-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..c32743e080d0 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.list_by_service(
@@ -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/2023-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..7fc24bc07707 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_email.list_by_notification(
@@ -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/2023-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..da365c38bd11 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification_recipient_user.list_by_notification(
@@ -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/2023-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..db5f3a7e8739 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.notification.list_by_service(
@@ -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/2023-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..b00b77dc9171 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.list_by_service(
@@ -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/2023-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..8620344ba7e4 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/2023-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..dcd3ac29ed22 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
@@ -26,16 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
)
- print(response)
+ for item in response:
+ print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPolicies.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..11ad0151d970 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_description.list_by_service(
@@ -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/2023-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..06aa8c3a2680 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.list_references(
@@ -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/2023-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..ebc561afff67 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
@@ -26,16 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.policy_fragment.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
)
- print(response)
+ for item in response:
+ print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPolicyFragments.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementListPolicyFragments.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_list_policy_restrictions.py
similarity index 81%
rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_geo.py
rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_policy_restrictions.py
index 40167add3648..e5b4c9e0c359 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_list_policy_restrictions.py
@@ -14,7 +14,7 @@
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
- python api_management_get_reports_by_geo.py
+ python api_management_list_policy_restrictions.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.reports.list_by_geo(
+ response = client.policy_restriction.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
- filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
)
for item in response:
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementGetReportsByGeo.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementListPolicyRestrictions.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_portal_config.py
index eec36b1a63b9..ada19772f83b 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
@@ -26,16 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
)
- print(response)
+ for item in response:
+ print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListPortalConfig.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..10f026d664c8 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.list_by_service(
@@ -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/2023-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..d5a573a5aae2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_settings.list_by_service(
@@ -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/2023-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..48dbc09b51e1 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.list_by_service(
@@ -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/2023-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..c62aeb05a8d1 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.private_endpoint_connection.list_private_link_resources(
@@ -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/2023-09-01-preview/examples/ApiManagementListPrivateLinkGroupResources.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_list_product_api_links.py
similarity index 80%
rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_user.py
rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_api_links.py
index 72a9f8525676..2d41997f4830 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_list_product_api_links.py
@@ -14,7 +14,7 @@
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
- python api_management_get_reports_by_user.py
+ 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,
@@ -26,18 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.reports.list_by_user(
+ response = client.product_api_link.list_by_product(
resource_group_name="rg1",
service_name="apimService1",
- filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ product_id="product1",
)
for item in response:
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/2023-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..d27575404d34 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_api.list_by_product(
@@ -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/2023-09-01-preview/examples/ApiManagementListProductApis.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_list_product_group_links.py
similarity index 80%
rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_product.py
rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_product_group_links.py
index 3c5db9edee1c..5d2695b71521 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_list_product_group_links.py
@@ -14,7 +14,7 @@
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
- python api_management_get_reports_by_product.py
+ 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,
@@ -26,18 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.reports.list_by_product(
+ response = client.product_group_link.list_by_product(
resource_group_name="rg1",
service_name="apimService1",
- filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ product_id="product1",
)
for item in response:
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/2023-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..6224eca5aa65 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_group.list_by_product(
@@ -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/2023-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..071f0e753817 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_policy.list_by_product(
@@ -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/2023-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..19aa6d4173b2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_subscriptions.list(
@@ -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/2023-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..04eca612328e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.list_by_product(
@@ -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/2023-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..58aa60541946 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wikis.list(
@@ -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/2023-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..269714fa417b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.list_by_service(
@@ -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/2023-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..13e24f24abc4 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.list_by_tags(
@@ -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/2023-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..f4c76f1ef2da 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.region.list_by_service(
@@ -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/2023-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..82113820dd0b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.delegation_settings.list_secrets(
@@ -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/2023-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..1c1e5d26dccd 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.list_secrets(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListSecretsTenantAccess.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..d7079a50c9f3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.list()
@@ -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/2023-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..e58b867dba62 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.list_by_resource_group(
@@ -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/2023-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..39b8997b2970 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service_skus.list_available_service_skus(
@@ -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/2023-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..7a366af8c5f4 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service_skus.list_available_service_skus(
@@ -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/2023-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..111ebfe37ea1 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_skus.list()
@@ -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/2023-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..cdb3e2597465 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.list(
@@ -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/2023-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..4edc483aad41
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_api_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a85f8075401c
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_operation_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..cf835b0926ce
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.tag_product_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..67f9d41eb9d5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag_resource.list_by_service(
@@ -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/2023-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..f2df11f22637 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.list_by_service(
@@ -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/2023-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..aca1b9ca5563 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.list_by_service(
@@ -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/2023-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..1e508eee0c20 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.list_by_service(
@@ -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/2023-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..08a635f01ad2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_settings.list_by_service(
@@ -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/2023-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..054e89ecb338 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user_group.list(
@@ -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/2023-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..c49f90933649 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user_identities.list(
@@ -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/2023-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..ab4c78c6d2d6 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user_subscription.list(
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementListUserSubscriptions.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..4b693123f141 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.list_by_service(
@@ -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/2023-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..4ad4178ee439
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation_policy.list_by_operation(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="599e2953193c3c0bd0b3e2fa",
+ operation_id="599e29ab193c3c0bd0b3e2fb",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a778b5720280
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.list_by_api(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..e61b37f7e256
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_policy.list_by_api(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="5600b59475ff190048040001",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementListWorkspaceApiPolicies.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_list_workspace_api_releases.py
similarity index 80%
rename from sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_get_reports_by_operation.py
rename to sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_list_workspace_api_releases.py
index a98babd79de4..b637b698ea43 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_list_workspace_api_releases.py
@@ -14,7 +14,7 @@
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
- python api_management_get_reports_by_operation.py
+ 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,
@@ -26,18 +26,19 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.reports.list_by_operation(
+ response = client.workspace_api_release.list_by_service(
resource_group_name="rg1",
service_name="apimService1",
- filter="timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'",
+ workspace_id="wks1",
+ api_id="a1",
)
for item in response:
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/2023-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..b32045075afe
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_revision.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="57d2ef278aa04f0888cba3f3",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..65700ba8da54
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_schema.list_by_api(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="59d5b28d1f7fab116c282650",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..5df4900477a3
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f7a2e6ad9519
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..13b898403bce
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group_user.list(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="57d2ef278aa04f0888cba3f3",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..c90e35695f4e
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..ba6a6dc2c6bc
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..028bd782303c
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_email.list_by_notification(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..7b0551c82f2a
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification_recipient_user.list_by_notification(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ notification_name="RequestPublisherNotificationMessage",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..a8ee23a1fc96
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_notification.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..007b42fdc047
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy.list_by_api(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..b015c06f2fda
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.list_references(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ id="policyFragment1",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..b24265dc5338
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_policy_fragment.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..e54eb7a6f6d3
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_api_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="product1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..fc88a0c94ed8
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_group_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="product1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..36feaa823c09
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product_policy.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="armTemplateProduct4",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..e91573176d08
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..c484d77262c1
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_global_schema.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..52471fb796ae
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.list(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..545962699dd6
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_api_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..8affd8e7534c
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_operation_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..2313cbb4e200
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag_product_link.list_by_product(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="tag1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..96c0ecd81704
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..bbbff887e490
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace.list_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ )
+ for item in response:
+ print(item)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..312223c49eda 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.list_value(
@@ -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/2023-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..35f1fda35794 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.list_secrets(
@@ -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/2023-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..2020590e3083 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.begin_perform_connectivity_check_async(
@@ -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/2023-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..1742c907fdd4 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.begin_perform_connectivity_check_async(
@@ -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/2023-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..b5a35aed5dc5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.get(
@@ -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/2023-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..e6bc7c6490cf 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.delegation_settings.get(
@@ -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/2023-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..02878b776d3b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_in_settings.get(
@@ -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/2023-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..6ffa0713ea95 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_up_settings.get(
@@ -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/2023-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..72257ffe9012 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.delegation_settings.create_or_update(
@@ -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/2023-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..766914f2a85f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_in_settings.create_or_update(
@@ -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/2023-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..8898bdf6b10c 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.sign_up_settings.create_or_update(
@@ -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/2023-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..6e1078774ec2 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
@@ -26,10 +26,10 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.delegation_settings.update(
+ client.delegation_settings.update(
resource_group_name="rg1",
service_name="apimService1",
if_match="*",
@@ -42,9 +42,8 @@ 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/2023-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..56f30be7c560 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
@@ -26,18 +26,17 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.sign_in_settings.update(
+ client.sign_in_settings.update(
resource_group_name="rg1",
service_name="apimService1",
if_match="*",
parameters={"properties": {"enabled": True}},
)
- 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/2023-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..d96b834b25ab 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
@@ -26,10 +26,10 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.sign_up_settings.update(
+ client.sign_up_settings.update(
resource_group_name="rg1",
service_name="apimService1",
if_match="*",
@@ -40,9 +40,8 @@ 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/2023-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..cedb47e733de 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
@@ -26,19 +26,18 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.authorization.confirm_consent_code(
+ client.authorization.confirm_consent_code(
resource_group_name="rg1",
service_name="apimService1",
authorization_provider_id="aadwithauthcode",
authorization_id="authz1",
parameters={"consentCode": "theconsentcode"},
)
- 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/2023-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..c01a72538dd2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.certificate.refresh_secret(
@@ -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/2023-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..f8b0e6fe9b5e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.begin_refresh_secret(
@@ -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/2023-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..81beb807c9cd
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.begin_refresh_secret(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop2",
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..bbc5cd9baad5 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_restore(
@@ -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/2023-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..6b64e7efbd4b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.check_name_availability(
@@ -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/2023-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..f35237de0ba2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_delete(
@@ -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/2023-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..431977f95be1 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
@@ -26,13 +26,13 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get_domain_ownership_identifier()
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementServiceGetDomainOwnershipIdentifier.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..894246953893 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get(
@@ -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/2023-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..92c44cf02b7b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.network_status.list_by_service(
@@ -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/2023-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..642cb74124b4 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.network_status.list_by_location(
@@ -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/2023-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..412943be82da 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.outbound_network_dependencies_endpoints.list_by_service(
@@ -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/2023-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..1c5858ef67ae 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get(
@@ -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/2023-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..fd62c57275d9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get(
@@ -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/2023-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..1418605b7182 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.get_sso_token(
@@ -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/2023-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..be4b1b7792d9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_migrate_to_stv2(
@@ -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/2023-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..888443b64ea3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.list_secrets(
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementSubscriptionListSecrets.json
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..40170341266d 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
@@ -26,17 +26,16 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.subscription.regenerate_primary_key(
+ client.subscription.regenerate_primary_key(
resource_group_name="rg1",
service_name="apimService1",
sid="testsub",
)
- 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/2023-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..d5e9e2f2f303 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
@@ -26,17 +26,16 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.subscription.regenerate_secondary_key(
+ client.subscription.regenerate_secondary_key(
resource_group_name="rg1",
service_name="apimService1",
sid="testsub",
)
- 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/2023-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..cf82ef6bc533 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
@@ -26,17 +26,16 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.tenant_access.regenerate_primary_key(
+ client.tenant_access.regenerate_primary_key(
resource_group_name="rg1",
service_name="apimService1",
access_name="access",
)
- 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/2023-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..dc9e66bdcdd3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_configuration.get_sync_state(
@@ -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/2023-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..cd2a18df9fed 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_configuration.begin_deploy(
@@ -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/2023-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..971069689c7a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_configuration.begin_save(
@@ -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/2023-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..33855aa42291 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_configuration.begin_validate(
@@ -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/2023-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..839b0adb66ac 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_create_or_update(
@@ -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/2023-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..40a49ed73b72 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api.update(
@@ -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/2023-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..27842573112b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_diagnostic.update(
@@ -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/2023-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..84ee53cbd1e9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_issue.update(
@@ -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/2023-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..01d9befa596e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_operation.update(
@@ -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/2023-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..76806e990521 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_release.update(
@@ -37,7 +37,7 @@ def main():
if_match="*",
parameters={
"properties": {
- "apiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1",
"notes": "yahooagain",
}
},
@@ -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/2023-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..74a70b77cd4e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_version_set.update(
@@ -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/2023-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..444234dbe42e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_wiki.update(
@@ -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/2023-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..713cc40bebe6 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.authorization_server.update(
@@ -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/2023-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..ca002caa27f9 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.backend.update(
@@ -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/2023-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..84c55e65a700 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.cache.update(
@@ -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/2023-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..4358f94c7be4 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.diagnostic.update(
@@ -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/2023-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..5624bee296c2 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.gateway.update(
@@ -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/2023-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..01be2c157a17 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.graph_ql_api_resolver.update(
@@ -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/2023-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..0feabdfd09ae 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.group.update(
@@ -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/2023-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..497eaa9849c1 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.identity_provider.update(
@@ -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/2023-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..6236f8802780 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.logger.update(
@@ -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/2023-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..05746735d82b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.named_value.begin_update(
@@ -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/2023-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..ab0ba5286099 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.open_id_connect_provider.update(
@@ -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/2023-09-01-preview/examples/ApiManagementUpdateOpenIdConnectProvider.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_policy_restriction.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_policy_restriction.py
new file mode 100644
index 000000000000..fbfc9d38673b
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_policy_restriction.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_update_policy_restriction.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ policy_restriction_id="policyRestriction1",
+ if_match="*",
+ parameters={"properties": {"scope": "Sample Path 2 to the policy document."}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementUpdatePolicyRestriction.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_update_portal_config.py
index 5ef974ca315e..627f33a4988e 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_config.update(
@@ -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/2023-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..b56397bde871 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.portal_revision.begin_update(
@@ -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/2023-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..31c02005e1d3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product.update(
@@ -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/2023-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..453072090d88 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.product_wiki.update(
@@ -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/2023-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..24e784931f6f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.quota_by_counter_keys.update(
@@ -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/2023-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..b56b0eeb2c87 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.quota_by_period_keys.update(
@@ -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/2023-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..38048b90f3ad 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_update(
@@ -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/2023-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..3c51d0de7b3b 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_update(
@@ -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/2023-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..69bca7ab590a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_management_service.begin_update(
@@ -37,17 +37,17 @@ def main():
"additionalLocations": [
{
"location": "Australia East",
- "publicIpAddressId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/apim-australia-east-publicip",
+ "publicIpAddressId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/apim-australia-east-publicip",
"sku": {"capacity": 3, "name": "Premium"},
"virtualNetworkConfiguration": {
- "subnetResourceId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/apimaeavnet/subnets/default"
+ "subnetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/apimaeavnet/subnets/default"
},
"zones": ["1", "2", "3"],
}
],
- "publicIpAddressId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/publicip-apim-japan-east",
+ "publicIpAddressId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/publicip-apim-japan-east",
"virtualNetworkConfiguration": {
- "subnetResourceId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-apim-japaneast/subnets/apim2"
+ "subnetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-apim-japaneast/subnets/apim2"
},
"virtualNetworkType": "External",
},
@@ -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/2023-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..75202183e45d 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.subscription.update(
@@ -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/2023-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..6fd755dee289 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tag.update(
@@ -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/2023-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..3f5eb4b24d6f 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.email_template.update(
@@ -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/2023-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..7947ebd8491a 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.tenant_access.update(
@@ -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/2023-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..364de311b7bf 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.update(
@@ -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/2023-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..d07c918154ab
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ 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/2023-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..4e323bf29f9b
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ if_match="*",
+ parameters={
+ "properties": {
+ "displayName": "Echo API New",
+ "path": "newecho",
+ "serviceUrl": "http://echoapi.cloudapp.net/api2",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..1bdf99b8d7c3
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_operation.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="echo-api",
+ operation_id="operationId",
+ if_match="*",
+ parameters={
+ "properties": {
+ "displayName": "Retrieve resource",
+ "method": "GET",
+ "request": {
+ "queryParameters": [
+ {
+ "defaultValue": "sample",
+ "description": 'A sample parameter that is required and has a default value of "sample".',
+ "name": "param1",
+ "required": True,
+ "type": "string",
+ "values": ["sample"],
+ }
+ ]
+ },
+ "responses": [
+ {"description": "Returned in all cases.", "headers": [], "representations": [], "statusCode": 200},
+ {"description": "Server Error.", "headers": [], "representations": [], "statusCode": 500},
+ ],
+ "templateParameters": [],
+ "urlTemplate": "/resource",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..0230eb939d30
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_release.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ api_id="a1",
+ release_id="testrev",
+ if_match="*",
+ parameters={
+ "properties": {
+ "apiId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/a1",
+ "notes": "yahooagain",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..895b2a0bf7d3
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_api_version_set.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ version_set_id="vs1",
+ if_match="*",
+ parameters={
+ "properties": {
+ "description": "Version configuration",
+ "displayName": "api set 1",
+ "versioningScheme": "Segment",
+ }
+ },
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..56a778d9e6f6
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_group.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ group_id="tempgroup",
+ if_match="*",
+ parameters={"properties": {"displayName": "temp group"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f4123c66d830
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.begin_update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testprop2",
+ if_match="*",
+ parameters={
+ "properties": {"displayName": "prop3name", "secret": False, "tags": ["foo", "bar2"], "value": "propValue"}
+ },
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..477b2f22eb84
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_product.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ product_id="testproduct",
+ if_match="*",
+ parameters={"properties": {"displayName": "Test Template ProductName 4"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..af78803188fe
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ if_match="*",
+ parameters={"properties": {"displayName": "testsub"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..1f27ed8899d7
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_tag.update(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ tag_id="temptag",
+ if_match="*",
+ parameters={"properties": {"displayName": "temp tag"}},
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..e234da6da821 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
@@ -26,17 +26,16 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.user_confirmation_password.send(
+ client.user_confirmation_password.send(
resource_group_name="rg1",
service_name="apimService1",
user_id="57127d485157a511ace86ae7",
)
- 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/2023-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..f17e05e347f3 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.generate_sso_url(
@@ -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/2023-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..bc1adce3d515 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
@@ -26,7 +26,7 @@
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
- subscription_id="subid",
+ subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.user.get_shared_access_token(
@@ -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/2023-09-01-preview/examples/ApiManagementUserToken.json
if __name__ == "__main__":
main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_validate_policies.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_validate_policies.py
new file mode 100644
index 000000000000..166bcd808a77
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_validate_policies.py
@@ -0,0 +1,41 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+from azure.identity import DefaultAzureCredential
+from azure.mgmt.apimanagement import ApiManagementClient
+
+"""
+# PREREQUISITES
+ pip install azure-identity
+ pip install azure-mgmt-apimanagement
+# USAGE
+ python api_management_validate_policies.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.policy_restriction_validations.begin_by_service(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ ).result()
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementValidatePolicies.json
+if __name__ == "__main__":
+ main()
diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_named_value_list_value.py b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_named_value_list_value.py
new file mode 100644
index 000000000000..9f777645543d
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_named_value.list_value(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ named_value_id="testarmTemplateproperties2",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..d8bd19707ab9
--- /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="00000000-0000-0000-0000-000000000000",
+ )
+
+ response = client.workspace_subscription.list_secrets(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="5931a769d8d14f0ad8ce13b8",
+ )
+ print(response)
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..f3993b785657
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_regenerate_primary_key.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_workspace_subscription_regenerate_primary_key.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_subscription.regenerate_primary_key(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-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..66da615e8fdb
--- /dev/null
+++ b/sdk/apimanagement/azure-mgmt-apimanagement/generated_samples/api_management_workspace_subscription_regenerate_secondary_key.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_workspace_subscription_regenerate_secondary_key.py
+
+ Before run the sample, please set the values of the client ID, tenant ID and client secret
+ of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
+ https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
+"""
+
+
+def main():
+ client = ApiManagementClient(
+ credential=DefaultAzureCredential(),
+ subscription_id="00000000-0000-0000-0000-000000000000",
+ )
+
+ client.workspace_subscription.regenerate_secondary_key(
+ resource_group_name="rg1",
+ service_name="apimService1",
+ workspace_id="wks1",
+ sid="testsub",
+ )
+
+
+# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-09-01-preview/examples/ApiManagementWorkspaceSubscriptionRegenerateSecondaryKey.json
+if __name__ == "__main__":
+ main()