diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-mgmt-appconfiguration/CHANGELOG.md index eb53ca892b11..43b6a6d285a8 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/CHANGELOG.md @@ -1,5 +1,43 @@ # Release History +## 6.0.0b1 (2026-01-19) + +### Features Added + + - Model `AppConfigurationManagementClient` added parameter `cloud_setting` in method `__init__` + - Client `AppConfigurationManagementClient` added method `send_request` + - Model `ConfigurationStoreUpdateParameters` added property `properties` + - Model `DeletedConfigurationStore` added property `system_data` + - Model `KeyValue` added property `system_data` + - Model `PrivateEndpointConnection` added property `system_data` + - Model `PrivateEndpointConnectionReference` added property `properties` + - Model `PrivateLinkResource` added property `system_data` + - Model `Resource` added property `system_data` + - Model `Snapshot` added property `system_data` + - Model `TrackedResource` added property `system_data` + - Added model `AzureFrontDoorProperties` + - Added model `ConfigurationStorePropertiesUpdateParameters` + - Added model `ManagedOnBehalfOfConfiguration` + - Added model `MoboBrokerResource` + - Added model `ProxyResource` + - Added model `TelemetryProperties` + +### Breaking Changes + + - This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration. + - For the method breakings, please refer to https://aka.ms/azsdk/python/migrate/operations for migration. + - Model `ConfigurationStoreUpdateParameters` moved instance variable `encryption`, `disable_local_auth`, `public_network_access`, `enable_purge_protection`, `data_plane_proxy` and `default_key_value_revision_retention_period_in_seconds` under property `properties` + - Model `PrivateEndpointConnectionReference` moved instance variable `provisioning_state`, `private_endpoint` and `private_link_service_connection_state` under property `properties` + - Method `ConfigurationStoresOperations.list` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ConfigurationStoresOperations.list_by_resource_group` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ConfigurationStoresOperations.list_keys` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `Operations.list` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `ReplicasOperations.list_by_configuration_store` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + +### Other Changes + + - Deleted model `ErrorDetails`/`ErrorResponseAutoGenerated` which actually were not used by SDK users + ## 5.0.0 (2025-06-17) ### Features Added diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/MANIFEST.in b/sdk/appconfiguration/azure-mgmt-appconfiguration/MANIFEST.in index b7da44eaea08..0149f1c9d165 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/MANIFEST.in +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/MANIFEST.in @@ -1,7 +1,7 @@ -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/appconfiguration/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/_metadata.json b/sdk/appconfiguration/azure-mgmt-appconfiguration/_metadata.json index dea50c4db195..df72e324f01c 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/_metadata.json +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/_metadata.json @@ -1,11 +1,7 @@ { - "commit": "43ec634741a48376e9dbf4371e7520a9eb0a1cfa", + "apiVersion": "2025-06-01-preview", + "commit": "061d81271653458662f0be74f3fd79eb2b1db60e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.35.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/appconfiguration/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-2024-06-01 --use=@autorest/python@6.35.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/appconfiguration/resource-manager/readme.md" + "typespec_src": "specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/AppConfiguration", + "emitterVersion": "0.57.1" } \ No newline at end of file diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/apiview-properties.json b/sdk/appconfiguration/azure-mgmt-appconfiguration/apiview-properties.json new file mode 100644 index 000000000000..23699ab0f53f --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/apiview-properties.json @@ -0,0 +1,124 @@ +{ + "CrossLanguagePackageId": "Microsoft.AppConfiguration", + "CrossLanguageDefinitionId": { + "azure.mgmt.appconfiguration.models.ApiKey": "Microsoft.AppConfiguration.ApiKey", + "azure.mgmt.appconfiguration.models.AzureFrontDoorProperties": "Microsoft.AppConfiguration.AzureFrontDoorProperties", + "azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters": "Microsoft.AppConfiguration.CheckNameAvailabilityParameters", + "azure.mgmt.appconfiguration.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.appconfiguration.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.appconfiguration.models.ConfigurationStore": "Microsoft.AppConfiguration.ConfigurationStore", + "azure.mgmt.appconfiguration.models.ConfigurationStoreProperties": "Microsoft.AppConfiguration.ConfigurationStoreProperties", + "azure.mgmt.appconfiguration.models.ConfigurationStorePropertiesUpdateParameters": "Microsoft.AppConfiguration.ConfigurationStorePropertiesUpdateParameters", + "azure.mgmt.appconfiguration.models.ConfigurationStoreUpdateParameters": "Microsoft.AppConfiguration.ConfigurationStoreUpdateParameters", + "azure.mgmt.appconfiguration.models.DataPlaneProxyProperties": "Microsoft.AppConfiguration.DataPlaneProxyProperties", + "azure.mgmt.appconfiguration.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.appconfiguration.models.DeletedConfigurationStore": "Microsoft.AppConfiguration.DeletedConfigurationStore", + "azure.mgmt.appconfiguration.models.DeletedConfigurationStoreProperties": "Microsoft.AppConfiguration.DeletedConfigurationStoreProperties", + "azure.mgmt.appconfiguration.models.EncryptionProperties": "Microsoft.AppConfiguration.EncryptionProperties", + "azure.mgmt.appconfiguration.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.appconfiguration.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.appconfiguration.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.appconfiguration.models.KeyValue": "Microsoft.AppConfiguration.KeyValue", + "azure.mgmt.appconfiguration.models.KeyValueFilter": "Microsoft.AppConfiguration.KeyValueFilter", + "azure.mgmt.appconfiguration.models.KeyValueProperties": "Microsoft.AppConfiguration.KeyValueProperties", + "azure.mgmt.appconfiguration.models.KeyVaultProperties": "Microsoft.AppConfiguration.KeyVaultProperties", + "azure.mgmt.appconfiguration.models.LogSpecification": "Microsoft.AppConfiguration.LogSpecification", + "azure.mgmt.appconfiguration.models.ManagedOnBehalfOfConfiguration": "Azure.ResourceManager.CommonTypes.ManagedOnBehalfOfConfiguration", + "azure.mgmt.appconfiguration.models.MetricDimension": "Microsoft.AppConfiguration.MetricDimension", + "azure.mgmt.appconfiguration.models.MetricSpecification": "Microsoft.AppConfiguration.MetricSpecification", + "azure.mgmt.appconfiguration.models.MoboBrokerResource": "Azure.ResourceManager.CommonTypes.MoboBrokerResource", + "azure.mgmt.appconfiguration.models.NameAvailabilityStatus": "Microsoft.AppConfiguration.NameAvailabilityStatus", + "azure.mgmt.appconfiguration.models.OperationDefinition": "Microsoft.AppConfiguration.OperationDefinition", + "azure.mgmt.appconfiguration.models.OperationDefinitionDisplay": "Microsoft.AppConfiguration.OperationDefinitionDisplay", + "azure.mgmt.appconfiguration.models.OperationProperties": "Microsoft.AppConfiguration.OperationProperties", + "azure.mgmt.appconfiguration.models.PrivateEndpoint": "Microsoft.AppConfiguration.PrivateEndpoint", + "azure.mgmt.appconfiguration.models.PrivateEndpointConnection": "Microsoft.AppConfiguration.PrivateEndpointConnection", + "azure.mgmt.appconfiguration.models.PrivateEndpointConnectionProperties": "Microsoft.AppConfiguration.PrivateEndpointConnectionProperties", + "azure.mgmt.appconfiguration.models.PrivateEndpointConnectionReference": "Microsoft.AppConfiguration.PrivateEndpointConnectionReference", + "azure.mgmt.appconfiguration.models.PrivateLinkResource": "Microsoft.AppConfiguration.PrivateLinkResource", + "azure.mgmt.appconfiguration.models.PrivateLinkResourceProperties": "Microsoft.AppConfiguration.PrivateLinkResourceProperties", + "azure.mgmt.appconfiguration.models.PrivateLinkServiceConnectionState": "Microsoft.AppConfiguration.PrivateLinkServiceConnectionState", + "azure.mgmt.appconfiguration.models.RegenerateKeyParameters": "Microsoft.AppConfiguration.RegenerateKeyParameters", + "azure.mgmt.appconfiguration.models.Replica": "Microsoft.AppConfiguration.Replica", + "azure.mgmt.appconfiguration.models.ReplicaProperties": "Microsoft.AppConfiguration.ReplicaProperties", + "azure.mgmt.appconfiguration.models.ResourceIdentity": "Microsoft.AppConfiguration.ResourceIdentity", + "azure.mgmt.appconfiguration.models.ServiceSpecification": "Microsoft.AppConfiguration.ServiceSpecification", + "azure.mgmt.appconfiguration.models.Sku": "Microsoft.AppConfiguration.Sku", + "azure.mgmt.appconfiguration.models.Snapshot": "Microsoft.AppConfiguration.Snapshot", + "azure.mgmt.appconfiguration.models.SnapshotProperties": "Microsoft.AppConfiguration.SnapshotProperties", + "azure.mgmt.appconfiguration.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.appconfiguration.models.TelemetryProperties": "Microsoft.AppConfiguration.TelemetryProperties", + "azure.mgmt.appconfiguration.models.UserIdentity": "Microsoft.AppConfiguration.UserIdentity", + "azure.mgmt.appconfiguration.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.appconfiguration.models.ProvisioningState": "Microsoft.AppConfiguration.ProvisioningState", + "azure.mgmt.appconfiguration.models.ConnectionStatus": "Microsoft.AppConfiguration.ConnectionStatus", + "azure.mgmt.appconfiguration.models.ActionsRequired": "Microsoft.AppConfiguration.ActionsRequired", + "azure.mgmt.appconfiguration.models.PublicNetworkAccess": "Microsoft.AppConfiguration.PublicNetworkAccess", + "azure.mgmt.appconfiguration.models.AuthenticationMode": "Microsoft.AppConfiguration.AuthenticationMode", + "azure.mgmt.appconfiguration.models.PrivateLinkDelegation": "Microsoft.AppConfiguration.PrivateLinkDelegation", + "azure.mgmt.appconfiguration.models.CreateMode": "Microsoft.AppConfiguration.CreateMode", + "azure.mgmt.appconfiguration.models.IdentityType": "Microsoft.AppConfiguration.IdentityType", + "azure.mgmt.appconfiguration.models.ReplicaProvisioningState": "Microsoft.AppConfiguration.ReplicaProvisioningState", + "azure.mgmt.appconfiguration.models.SnapshotStatus": "Microsoft.AppConfiguration.SnapshotStatus", + "azure.mgmt.appconfiguration.models.CompositionType": "Microsoft.AppConfiguration.CompositionType", + "azure.mgmt.appconfiguration.models.ConfigurationResourceType": "Microsoft.AppConfiguration.ConfigurationResourceType", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.get": "Microsoft.AppConfiguration.ConfigurationStores.get", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.get": "Microsoft.AppConfiguration.ConfigurationStores.get", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.begin_create": "Microsoft.AppConfiguration.ConfigurationStores.create", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.begin_create": "Microsoft.AppConfiguration.ConfigurationStores.create", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.begin_update": "Microsoft.AppConfiguration.ConfigurationStores.update", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.begin_update": "Microsoft.AppConfiguration.ConfigurationStores.update", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.begin_delete": "Microsoft.AppConfiguration.ConfigurationStores.delete", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.begin_delete": "Microsoft.AppConfiguration.ConfigurationStores.delete", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.list_by_resource_group": "Microsoft.AppConfiguration.ConfigurationStores.listByResourceGroup", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.list_by_resource_group": "Microsoft.AppConfiguration.ConfigurationStores.listByResourceGroup", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.list": "Microsoft.AppConfiguration.ConfigurationStores.list", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.list": "Microsoft.AppConfiguration.ConfigurationStores.list", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.list_keys": "Microsoft.AppConfiguration.ConfigurationStores.listKeys", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.list_keys": "Microsoft.AppConfiguration.ConfigurationStores.listKeys", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.regenerate_key": "Microsoft.AppConfiguration.ConfigurationStores.regenerateKey", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.regenerate_key": "Microsoft.AppConfiguration.ConfigurationStores.regenerateKey", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.get_deleted": "Microsoft.AppConfiguration.DeletedConfigurationStores.getDeleted", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.get_deleted": "Microsoft.AppConfiguration.DeletedConfigurationStores.getDeleted", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.begin_purge_deleted": "Microsoft.AppConfiguration.DeletedConfigurationStores.purgeDeleted", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.begin_purge_deleted": "Microsoft.AppConfiguration.DeletedConfigurationStores.purgeDeleted", + "azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations.list_deleted": "Microsoft.AppConfiguration.ConfigurationStoresOperationGroup.listDeleted", + "azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations.list_deleted": "Microsoft.AppConfiguration.ConfigurationStoresOperationGroup.listDeleted", + "azure.mgmt.appconfiguration.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.AppConfiguration.PrivateEndpointConnections.get", + "azure.mgmt.appconfiguration.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.AppConfiguration.PrivateEndpointConnections.get", + "azure.mgmt.appconfiguration.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": "Microsoft.AppConfiguration.PrivateEndpointConnections.createOrUpdate", + "azure.mgmt.appconfiguration.aio.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": "Microsoft.AppConfiguration.PrivateEndpointConnections.createOrUpdate", + "azure.mgmt.appconfiguration.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.AppConfiguration.PrivateEndpointConnections.delete", + "azure.mgmt.appconfiguration.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.AppConfiguration.PrivateEndpointConnections.delete", + "azure.mgmt.appconfiguration.operations.PrivateEndpointConnectionsOperations.list_by_configuration_store": "Microsoft.AppConfiguration.PrivateEndpointConnections.listByConfigurationStore", + "azure.mgmt.appconfiguration.aio.operations.PrivateEndpointConnectionsOperations.list_by_configuration_store": "Microsoft.AppConfiguration.PrivateEndpointConnections.listByConfigurationStore", + "azure.mgmt.appconfiguration.operations.PrivateLinkResourcesOperations.get": "Microsoft.AppConfiguration.PrivateLinkResources.get", + "azure.mgmt.appconfiguration.aio.operations.PrivateLinkResourcesOperations.get": "Microsoft.AppConfiguration.PrivateLinkResources.get", + "azure.mgmt.appconfiguration.operations.PrivateLinkResourcesOperations.list_by_configuration_store": "Microsoft.AppConfiguration.PrivateLinkResources.listByConfigurationStore", + "azure.mgmt.appconfiguration.aio.operations.PrivateLinkResourcesOperations.list_by_configuration_store": "Microsoft.AppConfiguration.PrivateLinkResources.listByConfigurationStore", + "azure.mgmt.appconfiguration.operations.KeyValuesOperations.get": "Microsoft.AppConfiguration.KeyValues.get", + "azure.mgmt.appconfiguration.aio.operations.KeyValuesOperations.get": "Microsoft.AppConfiguration.KeyValues.get", + "azure.mgmt.appconfiguration.operations.KeyValuesOperations.create_or_update": "Microsoft.AppConfiguration.KeyValues.createOrUpdate", + "azure.mgmt.appconfiguration.aio.operations.KeyValuesOperations.create_or_update": "Microsoft.AppConfiguration.KeyValues.createOrUpdate", + "azure.mgmt.appconfiguration.operations.KeyValuesOperations.begin_delete": "Microsoft.AppConfiguration.KeyValues.delete", + "azure.mgmt.appconfiguration.aio.operations.KeyValuesOperations.begin_delete": "Microsoft.AppConfiguration.KeyValues.delete", + "azure.mgmt.appconfiguration.operations.ReplicasOperations.get": "Microsoft.AppConfiguration.Replicas.get", + "azure.mgmt.appconfiguration.aio.operations.ReplicasOperations.get": "Microsoft.AppConfiguration.Replicas.get", + "azure.mgmt.appconfiguration.operations.ReplicasOperations.begin_create": "Microsoft.AppConfiguration.Replicas.create", + "azure.mgmt.appconfiguration.aio.operations.ReplicasOperations.begin_create": "Microsoft.AppConfiguration.Replicas.create", + "azure.mgmt.appconfiguration.operations.ReplicasOperations.begin_delete": "Microsoft.AppConfiguration.Replicas.delete", + "azure.mgmt.appconfiguration.aio.operations.ReplicasOperations.begin_delete": "Microsoft.AppConfiguration.Replicas.delete", + "azure.mgmt.appconfiguration.operations.ReplicasOperations.list_by_configuration_store": "Microsoft.AppConfiguration.Replicas.listByConfigurationStore", + "azure.mgmt.appconfiguration.aio.operations.ReplicasOperations.list_by_configuration_store": "Microsoft.AppConfiguration.Replicas.listByConfigurationStore", + "azure.mgmt.appconfiguration.operations.SnapshotsOperations.get": "Microsoft.AppConfiguration.Snapshots.get", + "azure.mgmt.appconfiguration.aio.operations.SnapshotsOperations.get": "Microsoft.AppConfiguration.Snapshots.get", + "azure.mgmt.appconfiguration.operations.SnapshotsOperations.begin_create": "Microsoft.AppConfiguration.Snapshots.create", + "azure.mgmt.appconfiguration.aio.operations.SnapshotsOperations.begin_create": "Microsoft.AppConfiguration.Snapshots.create", + "azure.mgmt.appconfiguration.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.appconfiguration.aio.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.appconfiguration.operations.Operations.check_name_availability": "Microsoft.AppConfiguration.OperationsOperationGroup.checkNameAvailability", + "azure.mgmt.appconfiguration.aio.operations.Operations.check_name_availability": "Microsoft.AppConfiguration.OperationsOperationGroup.checkNameAvailability", + "azure.mgmt.appconfiguration.operations.Operations.regional_check_name_availability": "Microsoft.AppConfiguration.OperationsOperationGroup.regionalCheckNameAvailability", + "azure.mgmt.appconfiguration.aio.operations.Operations.regional_check_name_availability": "Microsoft.AppConfiguration.OperationsOperationGroup.regionalCheckNameAvailability" + } +} \ No newline at end of file diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py index ad8c867d7292..e88f7dc047ab 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._app_configuration_management_client import AppConfigurationManagementClient # type: ignore +from ._client import AppConfigurationManagementClient # type: ignore from ._version import VERSION __version__ = VERSION diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_client.py similarity index 77% rename from sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py rename to sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_client.py index b1fabc17cd0f..a984bcb5a090 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,7 +17,6 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models from ._configuration import AppConfigurationManagementClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( @@ -31,17 +30,16 @@ ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential class AppConfigurationManagementClient: # pylint: disable=too-many-instance-attributes - """AppConfigurationManagementClient. + """// (missing-service-description) Add service description. :ivar configuration_stores: ConfigurationStoresOperations operations :vartype configuration_stores: azure.mgmt.appconfiguration.operations.ConfigurationStoresOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appconfiguration.operations.Operations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.appconfiguration.operations.PrivateEndpointConnectionsOperations @@ -54,29 +52,47 @@ class AppConfigurationManagementClient: # pylint: disable=too-many-instance-att :vartype replicas: azure.mgmt.appconfiguration.operations.ReplicasOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.appconfiguration.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appconfiguration.operations.Operations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. 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 None. + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-06-01". Note that overriding this - default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is + "2025-06-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoint = "{endpoint}" + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = AppConfigurationManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -97,16 +113,14 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.configuration_stores = ConfigurationStoresOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -116,14 +130,15 @@ def __init__( self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize) self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -136,7 +151,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py index 9f84b405f53a..1321750b850b 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,6 +14,7 @@ from ._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential @@ -23,17 +24,30 @@ class AppConfigurationManagementClientConfiguration: # pylint: disable=too-many Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. 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 "2024-06-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is + "2025-06-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-06-01") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -42,6 +56,8 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION)) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/__init__.py @@ -1,6 +1,6 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/model_base.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/model_base.py new file mode 100644 index 000000000000..d962e0e8fceb --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/model_base.py @@ -0,0 +1,1327 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj # type: ignore[no-any-return] + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) # type: ignore[no-any-return] + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + try: + if ( + isinstance(obj, str) + and isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ): + # encoded string may be deserialized to sequence + return deserializer(obj) + except: # pylint: disable=bare-except + pass + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element # type: ignore[no-any-return] + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/serialization.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/serialization.py index f5187701d7be..81ec1de5922b 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/serialization.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -21,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -31,7 +30,6 @@ Mapping, Callable, MutableMapping, - List, ) try: @@ -229,12 +227,12 @@ class Model: serialization and deserialization. """ - _subtype_map: Dict[str, Dict[str, Any]] = {} - _attribute_map: Dict[str, Dict[str, Any]] = {} - _validation: Dict[str, Dict[str, Any]] = {} + _subtype_map: dict[str, dict[str, Any]] = {} + _attribute_map: dict[str, dict[str, Any]] = {} + _validation: dict[str, dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Optional[Dict[str, Any]] = {} + self.additional_properties: Optional[dict[str, Any]] = {} for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -311,7 +309,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -380,7 +378,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: def from_dict( cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, ) -> Self: """Parse a dict using given key extractor return a model. @@ -414,7 +412,7 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod @@ -528,7 +526,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -579,7 +577,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -789,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -823,13 +821,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1184,7 +1189,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1386,7 +1391,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1759,7 +1764,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises TypeError: if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1785,7 +1790,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_version.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_version.py index 34ea7990c4b4..858d8cac6565 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_version.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_version.py @@ -2,8 +2,8 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "6.0.0b1" diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/__init__.py index 88bd63c2e134..efe3ab8ef1f0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._app_configuration_management_client import AppConfigurationManagementClient # type: ignore +from ._client import AppConfigurationManagementClient # type: ignore try: from ._patch import __all__ as _patch_all diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_client.py similarity index 78% rename from sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py rename to sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_client.py index 74fd09dedd08..38547905ac88 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,7 +17,6 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer from ._configuration import AppConfigurationManagementClientConfiguration from .operations import ( @@ -31,17 +30,16 @@ ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential class AppConfigurationManagementClient: # pylint: disable=too-many-instance-attributes - """AppConfigurationManagementClient. + """// (missing-service-description) Add service description. :ivar configuration_stores: ConfigurationStoresOperations operations :vartype configuration_stores: azure.mgmt.appconfiguration.aio.operations.ConfigurationStoresOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appconfiguration.aio.operations.Operations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.appconfiguration.aio.operations.PrivateEndpointConnectionsOperations @@ -54,29 +52,47 @@ class AppConfigurationManagementClient: # pylint: disable=too-many-instance-att :vartype replicas: azure.mgmt.appconfiguration.aio.operations.ReplicasOperations :ivar snapshots: SnapshotsOperations operations :vartype snapshots: azure.mgmt.appconfiguration.aio.operations.SnapshotsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appconfiguration.aio.operations.Operations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. 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 None. + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-06-01". Note that overriding this - default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is + "2025-06-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoint = "{endpoint}" + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = AppConfigurationManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -98,17 +114,15 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), policies=_policies, **kwargs ) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.configuration_stores = ConfigurationStoresOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -118,8 +132,9 @@ def __init__( self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize) self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -127,7 +142,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -140,7 +155,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py index 5a324e34b3fc..f79c121000e7 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,6 +14,7 @@ from .._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential @@ -23,17 +24,30 @@ class AppConfigurationManagementClientConfiguration: # pylint: disable=too-many Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. 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 "2024-06-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is + "2025-06-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-06-01") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -42,6 +56,8 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION)) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/__init__.py index 38515cc7e967..c611b1e413fd 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,13 +12,13 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._configuration_stores_operations import ConfigurationStoresOperations # type: ignore +from ._operations import ConfigurationStoresOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import KeyValuesOperations # type: ignore +from ._operations import ReplicasOperations # type: ignore +from ._operations import SnapshotsOperations # type: ignore from ._operations import Operations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._key_values_operations import KeyValuesOperations # type: ignore -from ._replicas_operations import ReplicasOperations # type: ignore -from ._snapshots_operations import SnapshotsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -26,12 +26,12 @@ __all__ = [ "ConfigurationStoresOperations", - "Operations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", "KeyValuesOperations", "ReplicasOperations", "SnapshotsOperations", + "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_configuration_stores_operations.py deleted file mode 100644 index 6ce83e943b96..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_configuration_stores_operations.py +++ /dev/null @@ -1,1273 +0,0 @@ -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._configuration_stores_operations import ( - build_create_request, - build_delete_request, - build_get_deleted_request, - build_get_request, - build_list_by_resource_group_request, - build_list_deleted_request, - build_list_keys_request, - build_list_request, - build_purge_deleted_request, - build_regenerate_key_request, - build_update_request, -) -from .._configuration import AppConfigurationManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ConfigurationStoresOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s - :attr:`configuration_stores` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncItemPaged["_models.ConfigurationStore"]: - """Lists the configuration stores for a given subscription. - - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ConfigurationStore or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :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.ConfigurationStoreListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ConfigurationStore"]: - """Lists the configuration stores for a given resource group. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ConfigurationStore or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :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.ConfigurationStoreListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore: - """Gets the properties of the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: ConfigurationStore or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.ConfigurationStore - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - config_store_name: str, - config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_store_creation_parameters, (IOBase, bytes)): - _content = config_store_creation_parameters - else: - _json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore") - - _request = build_create_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - config_store_name: str, - config_store_creation_parameters: _models.ConfigurationStore, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationStore]: - """Creates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_creation_parameters: The parameters for creating a configuration store. - Required. - :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.models.ConfigurationStore - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - config_store_name: str, - config_store_creation_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationStore]: - """Creates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_creation_parameters: The parameters for creating a configuration store. - Required. - :type config_store_creation_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - config_store_name: str, - config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationStore]: - """Creates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_creation_parameters: The parameters for creating a configuration store. Is - either a ConfigurationStore type or a IO[bytes] type. Required. - :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.models.ConfigurationStore - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :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.ConfigurationStore] = 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_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - config_store_creation_parameters=config_store_creation_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationStore].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationStore]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, config_store_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, config_store_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - config_store_name: str, - config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_store_update_parameters, (IOBase, bytes)): - _content = config_store_update_parameters - else: - _json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - config_store_name: str, - config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationStore]: - """Updates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_update_parameters: The parameters for updating a configuration store. - Required. - :type config_store_update_parameters: - ~azure.mgmt.appconfiguration.models.ConfigurationStoreUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - config_store_name: str, - config_store_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationStore]: - """Updates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_update_parameters: The parameters for updating a configuration store. - Required. - :type config_store_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - config_store_name: str, - config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConfigurationStore]: - """Updates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_update_parameters: The parameters for updating a configuration store. Is - either a ConfigurationStoreUpdateParameters type or a IO[bytes] type. Required. - :type config_store_update_parameters: - ~azure.mgmt.appconfiguration.models.ConfigurationStoreUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :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.ConfigurationStore] = 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, - config_store_name=config_store_name, - config_store_update_parameters=config_store_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConfigurationStore].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConfigurationStore]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_keys( - self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ApiKey"]: - """Lists the access key for the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ApiKey or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.ApiKey] - :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.ApiKeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_keys_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApiKeyListResult", 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) - - @overload - async def regenerate_key( - self, - resource_group_name: str, - config_store_name: str, - regenerate_key_parameters: _models.RegenerateKeyParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApiKey: - """Regenerates an access key for the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. Required. - :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.models.RegenerateKeyParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApiKey or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.ApiKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_key( - self, - resource_group_name: str, - config_store_name: str, - regenerate_key_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApiKey: - """Regenerates an access key for the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. Required. - :type regenerate_key_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApiKey or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.ApiKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_key( - self, - resource_group_name: str, - config_store_name: str, - regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ApiKey: - """Regenerates an access key for the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. Is either a - RegenerateKeyParameters type or a IO[bytes] type. Required. - :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.models.RegenerateKeyParameters or - IO[bytes] - :return: ApiKey or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.ApiKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_key_parameters, (IOBase, bytes)): - _content = regenerate_key_parameters - else: - _json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters") - - _request = build_regenerate_key_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, 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("ApiKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_deleted(self, **kwargs: Any) -> AsyncItemPaged["_models.DeletedConfigurationStore"]: - """Gets information about the deleted configuration stores in a subscription. - - :return: An iterator like instance of either DeletedConfigurationStore or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.DeletedConfigurationStore] - :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.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get_deleted( - self, location: str, config_store_name: str, **kwargs: Any - ) -> _models.DeletedConfigurationStore: - """Gets a deleted Azure app configuration store. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: DeletedConfigurationStore or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.DeletedConfigurationStore - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None) - - _request = build_get_deleted_request( - location=location, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _purge_deleted_initial( - self, location: str, config_store_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_purge_deleted_request( - location=location, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Permanently deletes the specified configuration store. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._purge_deleted_initial( - location=location, - config_store_name=config_store_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_key_values_operations.py deleted file mode 100644 index a4d19c7cc313..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_key_values_operations.py +++ /dev/null @@ -1,386 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._key_values_operations import build_create_or_update_request, build_delete_request, build_get_request -from .._configuration import AppConfigurationManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class KeyValuesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s - :attr:`key_values` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any - ) -> _models.KeyValue: - """Gets the properties of the specified key-value. NOTE: This operation is intended for use in ARM - Template deployments. For all other scenarios involving App Configuration key-values the data - plane API should be used instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :return: KeyValue or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.KeyValue - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - key_value_name=key_value_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("KeyValue", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - key_value_parameters: _models.KeyValue, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.KeyValue: - """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For - all other scenarios involving App Configuration key-values the data plane API should be used - instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :param key_value_parameters: The parameters for creating a key-value. Required. - :type key_value_parameters: ~azure.mgmt.appconfiguration.models.KeyValue - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: KeyValue or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.KeyValue - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - key_value_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.KeyValue: - """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For - all other scenarios involving App Configuration key-values the data plane API should be used - instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :param key_value_parameters: The parameters for creating a key-value. Required. - :type key_value_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: KeyValue or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.KeyValue - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - key_value_parameters: Union[_models.KeyValue, IO[bytes]], - **kwargs: Any - ) -> _models.KeyValue: - """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For - all other scenarios involving App Configuration key-values the data plane API should be used - instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type - or a IO[bytes] type. Required. - :type key_value_parameters: ~azure.mgmt.appconfiguration.models.KeyValue or IO[bytes] - :return: KeyValue or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.KeyValue - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(key_value_parameters, (IOBase, bytes)): - _content = key_value_parameters - else: - _json = self._serialize.body(key_value_parameters, "KeyValue") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - key_value_name=key_value_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, 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("KeyValue", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - key_value_name=key_value_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a key-value. NOTE: This operation is intended for use in ARM Template deployments. For - all other scenarios involving App Configuration key-values the data plane API should be used - instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - key_value_name=key_value_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_operations.py index 342cedfbf197..847eb24fe8e2 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_operations.py @@ -1,13 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -18,177 +20,3644 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import ( - build_check_name_availability_request, - build_list_request, - build_regional_check_name_availability_request, + build_configuration_stores_create_request, + build_configuration_stores_delete_request, + build_configuration_stores_get_deleted_request, + build_configuration_stores_get_request, + build_configuration_stores_list_by_resource_group_request, + build_configuration_stores_list_deleted_request, + build_configuration_stores_list_keys_request, + build_configuration_stores_list_request, + build_configuration_stores_purge_deleted_request, + build_configuration_stores_regenerate_key_request, + build_configuration_stores_update_request, + build_key_values_create_or_update_request, + build_key_values_delete_request, + build_key_values_get_request, + build_operations_check_name_availability_request, + build_operations_list_request, + build_operations_regional_check_name_availability_request, + build_private_endpoint_connections_create_or_update_request, + build_private_endpoint_connections_delete_request, + build_private_endpoint_connections_get_request, + build_private_endpoint_connections_list_by_configuration_store_request, + build_private_link_resources_get_request, + build_private_link_resources_list_by_configuration_store_request, + build_replicas_create_request, + build_replicas_delete_request, + build_replicas_get_request, + build_replicas_list_by_configuration_store_request, + build_snapshots_create_request, + build_snapshots_get_request, ) from .._configuration import AppConfigurationManagementClientConfiguration +JSON = MutableMapping[str, Any] T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class Operations: +class ConfigurationStoresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s + :attr:`configuration_stores` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore: + """Gets the properties of the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: ConfigurationStore. The ConfigurationStore is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ConfigurationStore + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + + _request = build_configuration_stores_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConfigurationStore, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: Union[_models.ConfigurationStore, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(config_store_creation_parameters, (IOBase, bytes)): + _content = config_store_creation_parameters + else: + _content = json.dumps(config_store_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_configuration_stores_create_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: _models.ConfigurationStore, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.models.ConfigurationStore + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConfigurationStore. The ConfigurationStore + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConfigurationStore. The ConfigurationStore + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConfigurationStore. The ConfigurationStore + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: Union[_models.ConfigurationStore, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. Is + one of the following types: ConfigurationStore, JSON, IO[bytes] Required. + :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.models.ConfigurationStore + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ConfigurationStore. The ConfigurationStore + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = 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_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + config_store_creation_parameters=config_store_creation_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ConfigurationStore, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConfigurationStore].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConfigurationStore]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(config_store_update_parameters, (IOBase, bytes)): + _content = config_store_update_parameters + else: + _content = json.dumps(config_store_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_configuration_stores_update_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: + ~azure.mgmt.appconfiguration.models.ConfigurationStoreUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConfigurationStore. The ConfigurationStore + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConfigurationStore. The ConfigurationStore + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConfigurationStore. The ConfigurationStore + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. Is + one of the following types: ConfigurationStoreUpdateParameters, JSON, IO[bytes] Required. + :type config_store_update_parameters: + ~azure.mgmt.appconfiguration.models.ConfigurationStoreUpdateParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ConfigurationStore. The ConfigurationStore + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = 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, + config_store_name=config_store_name, + config_store_update_parameters=config_store_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ConfigurationStore, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConfigurationStore].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConfigurationStore]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_configuration_stores_delete_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ConfigurationStore"]: + """Lists the configuration stores for a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ConfigurationStore + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConfigurationStore]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_configuration_stores_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ConfigurationStore], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, *, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncItemPaged["_models.ConfigurationStore"]: + """Lists the configuration stores for a given subscription. + + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ConfigurationStore + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConfigurationStore]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_configuration_stores_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ConfigurationStore], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_keys( + self, resource_group_name: str, config_store_name: str, *, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ApiKey"]: + """Lists the access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ApiKey + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.ApiKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ApiKey]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_configuration_stores_list_keys_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ApiKey], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: _models.RegenerateKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.models.RegenerateKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApiKey. The ApiKey is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApiKey. The ApiKey is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApiKey. The ApiKey is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: Union[_models.RegenerateKeyParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Is one of the + following types: RegenerateKeyParameters, JSON, IO[bytes] Required. + :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.models.RegenerateKeyParameters or + JSON or IO[bytes] + :return: ApiKey. The ApiKey is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(regenerate_key_parameters, (IOBase, bytes)): + _content = regenerate_key_parameters + else: + _content = json.dumps(regenerate_key_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_configuration_stores_regenerate_key_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApiKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_deleted( + self, location: str, config_store_name: str, **kwargs: Any + ) -> _models.DeletedConfigurationStore: + """Gets a deleted Azure app configuration store. + + :param location: The name of the Azure region. Required. + :type location: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: DeletedConfigurationStore. The DeletedConfigurationStore is compatible with + MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.DeletedConfigurationStore + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None) + + _request = build_configuration_stores_get_deleted_request( + location=location, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeletedConfigurationStore, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _purge_deleted_initial( + self, location: str, config_store_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_configuration_stores_purge_deleted_request( + location=location, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Permanently deletes the specified configuration store. + + :param location: The name of the Azure region. Required. + :type location: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._purge_deleted_initial( + location=location, + config_store_name=config_store_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_deleted(self, **kwargs: Any) -> AsyncItemPaged["_models.DeletedConfigurationStore"]: + """Gets information about the deleted configuration stores in a subscription. + + :return: An iterator like instance of DeletedConfigurationStore + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.DeletedConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedConfigurationStore]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_configuration_stores_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeletedConfigurationStore], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection associated with the configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection + else: + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_or_update_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: + ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Is one of the + following types: PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: + ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = 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, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_configuration_store( + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """Lists all private endpoint connections for a configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_private_endpoint_connections_list_by_configuration_store_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets a private link resource that need to be created for a configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param group_name: The name of the private link resource group. Required. + :type group_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_private_link_resources_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_configuration_store( + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateLinkResource"]: + """Gets the private link resources that need to be created for a configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_private_link_resources_list_by_configuration_store_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class KeyValuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s + :attr:`key_values` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any + ) -> _models.KeyValue: + """Gets the properties of the specified key-value. NOTE: This operation is intended for use in ARM + Template deployments. For all other scenarios involving App Configuration key-values the data + plane API should be used instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + + _request = build_key_values_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + key_value_name=key_value_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.KeyValue, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: _models.KeyValue, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Required. + :type key_value_parameters: ~azure.mgmt.appconfiguration.models.KeyValue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Required. + :type key_value_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Required. + :type key_value_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Union[_models.KeyValue, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Is one of the following + types: KeyValue, JSON, IO[bytes] Required. + :type key_value_parameters: ~azure.mgmt.appconfiguration.models.KeyValue or JSON or IO[bytes] + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(key_value_parameters, (IOBase, bytes)): + _content = key_value_parameters + else: + _content = json.dumps(key_value_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_key_values_create_or_update_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + key_value_name=key_value_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.KeyValue, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_key_values_delete_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + key_value_name=key_value_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + key_value_name=key_value_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ReplicasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s + :attr:`replicas` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any + ) -> _models.Replica: + """Gets the properties of the specified replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :return: Replica. The Replica is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.Replica + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Replica] = kwargs.pop("cls", None) + + _request = build_replicas_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Replica, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: Union[_models.Replica, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(replica_creation_parameters, (IOBase, bytes)): + _content = replica_creation_parameters + else: + _content = json.dumps(replica_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replicas_create_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: _models.Replica, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Required. + :type replica_creation_parameters: ~azure.mgmt.appconfiguration.models.Replica + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Replica. The Replica is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Required. + :type replica_creation_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Replica. The Replica is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Required. + :type replica_creation_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Replica. The Replica is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: Union[_models.Replica, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Is one of the + following types: Replica, JSON, IO[bytes] Required. + :type replica_creation_parameters: ~azure.mgmt.appconfiguration.models.Replica or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns Replica. The Replica is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replica] = 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_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + replica_creation_parameters=replica_creation_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Replica, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Replica].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Replica]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_replicas_delete_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_configuration_store( + self, resource_group_name: str, config_store_name: str, *, skip_token: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Replica"]: + """Lists the replicas for a given configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of Replica + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Replica]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_replicas_list_by_configuration_store_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Replica], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SnapshotsOperations: """ .. warning:: **DO NOT** instantiate this class directly. - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s - :attr:`operations` attribute. - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s + :attr:`snapshots` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, config_store_name: str, snapshot_name: str, **kwargs: Any + ) -> _models.Snapshot: + """Gets the properties of the specified snapshot. NOTE: This operation is intended for use in ARM + Template deployments. For all other scenarios involving App Configuration snapshots the data + plane API should be used instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :return: Snapshot. The Snapshot is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + + _request = build_snapshots_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Snapshot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - models = _models + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_create_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - async def check_name_availability( + async def begin_create( self, - check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: _models.Snapshot, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.NameAvailabilityStatus: - """Checks whether the configuration store name is available for use. + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates a snapshot. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration snapshots the data plane API should be used + instead. - :param check_name_availability_parameters: The object containing information for the - availability request. Required. - :type check_name_availability_parameters: - ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :param body: The parameters for creating a snapshot. Required. + :type body: ~azure.mgmt.appconfiguration.models.Snapshot :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: NameAvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def check_name_availability( - self, check_name_availability_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.NameAvailabilityStatus: - """Checks whether the configuration store name is available for use. + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates a snapshot. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration snapshots the data plane API should be used + instead. - :param check_name_availability_parameters: The object containing information for the - availability request. Required. - :type check_name_availability_parameters: IO[bytes] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :param body: The parameters for creating a snapshot. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates a snapshot. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration snapshots the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :param body: The parameters for creating a snapshot. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: NameAvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def check_name_availability( + async def begin_create( self, - check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: Union[_models.Snapshot, JSON, IO[bytes]], **kwargs: Any - ) -> _models.NameAvailabilityStatus: - """Checks whether the configuration store name is available for use. + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates a snapshot. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration snapshots the data plane API should be used + instead. - :param check_name_availability_parameters: The object containing information for the - availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type check_name_availability_parameters: - ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters or IO[bytes] - :return: NameAvailabilityStatus or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :param body: The parameters for creating a snapshot. Is one of the following types: Snapshot, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.appconfiguration.models.Snapshot or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.Snapshot] = 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_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + snapshot_name=snapshot_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability_parameters, (IOBase, bytes)): - _content = check_name_availability_parameters - else: - _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Snapshot, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Snapshot].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, 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("NameAvailabilityStatus", pipeline_response.http_response) +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s + :attr:`operations` attribute. + """ - return deserialized # type: ignore + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncItemPaged["_models.OperationDefinition"]: - """Lists the operations available from this provider. + def list(self, *, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncItemPaged["_models.OperationDefinition"]: + """List the operations for the provider. - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OperationDefinition or the result of cls(response) + :paramtype skip_token: str + :return: An iterator like instance of OperationDefinition :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.OperationDefinition] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OperationDefinition]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -201,13 +3670,18 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncItemPage def prepare_request(next_link=None): if not next_link: - _request = build_list_request( + _request = build_operations_list_request( skip_token=skip_token, - api_version=api_version, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -222,16 +3696,21 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationDefinition], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -244,13 +3723,149 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + @overload + async def check_name_availability( + self, + check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The request body. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, check_name_availability_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The request body. Required. + :type check_name_availability_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, check_name_availability_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The request body. Required. + :type check_name_availability_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The request body. Is one of the following types: + CheckNameAvailabilityParameters, JSON, IO[bytes] Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters or JSON or IO[bytes] + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_parameters, (IOBase, bytes)): + _content = check_name_availability_parameters + else: + _content = json.dumps(check_name_availability_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_operations_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NameAvailabilityStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload async def regional_check_name_availability( self, @@ -262,16 +3877,38 @@ async def regional_check_name_availability( ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. Required. + :param location: The location name. Required. :type location: str - :param check_name_availability_parameters: The object containing information for the - availability request. Required. + :param check_name_availability_parameters: The request body. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: NameAvailabilityStatus or the result of cls(response) + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param location: The location name. Required. + :type location: str + :param check_name_availability_parameters: The request body. Required. + :type check_name_availability_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ @@ -287,15 +3924,14 @@ async def regional_check_name_availability( ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. Required. + :param location: The location name. Required. :type location: str - :param check_name_availability_parameters: The object containing information for the - availability request. Required. + :param check_name_availability_parameters: The request body. Required. :type check_name_availability_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: NameAvailabilityStatus or the result of cls(response) + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ @@ -304,19 +3940,18 @@ async def regional_check_name_availability( async def regional_check_name_availability( self, location: str, - check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], + check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, JSON, IO[bytes]], **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. Required. + :param location: The location name. Required. :type location: str - :param check_name_availability_parameters: The object containing information for the - availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type. - Required. + :param check_name_availability_parameters: The request body. Is one of the following types: + CheckNameAvailabilityParameters, JSON, IO[bytes] Required. :type check_name_availability_parameters: - ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters or IO[bytes] - :return: NameAvailabilityStatus or the result of cls(response) + ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters or JSON or IO[bytes] + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ @@ -329,33 +3964,33 @@ async def regional_check_name_availability( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) content_type = content_type or "application/json" - _json = None _content = None if isinstance(check_name_availability_parameters, (IOBase, bytes)): _content = check_name_availability_parameters else: - _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") + _content = json.dumps(check_name_availability_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_regional_check_name_availability_request( + _request = build_operations_regional_check_name_availability_request( location=location, subscription_id=self._config.subscription_id, - api_version=api_version, content_type=content_type, - json=_json, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -363,11 +3998,22 @@ async def regional_check_name_availability( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NameAvailabilityStatus, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 665d80c81dbd..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,540 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._private_endpoint_connections_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_configuration_store_request, -) -from .._configuration import AppConfigurationManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_configuration_store( - self, resource_group_name: str, config_store_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: - """Lists all private endpoint connections for a configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :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.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_configuration_store_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets the specified private endpoint connection associated with the configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection - else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Update the state of the specified private endpoint connection associated with the configuration - store. This operation cannot be used to create a private endpoint connection. Private endpoint - connections must be created with the Network resource provider. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. Required. - :type private_endpoint_connection: - ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Update the state of the specified private endpoint connection associated with the configuration - store. This operation cannot be used to create a private endpoint connection. Private endpoint - connections must be created with the Network resource provider. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. Required. - :type private_endpoint_connection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Update the state of the specified private endpoint connection associated with the configuration - store. This operation cannot be used to create a private endpoint connection. Private endpoint - connections must be created with the Network resource provider. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type private_endpoint_connection: - ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :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.PrivateEndpointConnection] = 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, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index af315bc61328..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,206 +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 collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._private_link_resources_operations import ( - build_get_request, - build_list_by_configuration_store_request, -) -from .._configuration import AppConfigurationManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_configuration_store( - self, resource_group_name: str, config_store_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.PrivateLinkResource] - :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.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_configuration_store_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Gets a private link resource that need to be created for a configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param group_name: The name of the private link resource group. Required. - :type group_name: str - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.PrivateLinkResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_replicas_operations.py deleted file mode 100644 index 3ee96fefc551..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_replicas_operations.py +++ /dev/null @@ -1,545 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._replicas_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_configuration_store_request, -) -from .._configuration import AppConfigurationManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ReplicasOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s - :attr:`replicas` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_configuration_store( - self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Replica"]: - """Lists the replicas for a given configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either Replica or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.models.Replica] - :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.ReplicaListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_configuration_store_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ReplicaListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any - ) -> _models.Replica: - """Gets the properties of the specified replica. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :return: Replica or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.Replica - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Replica] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Replica", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - replica_creation_parameters: Union[_models.Replica, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(replica_creation_parameters, (IOBase, bytes)): - _content = replica_creation_parameters - else: - _json = self._serialize.body(replica_creation_parameters, "Replica") - - _request = build_create_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - replica_creation_parameters: _models.Replica, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Replica]: - """Creates a replica with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :param replica_creation_parameters: The parameters for creating a replica. Required. - :type replica_creation_parameters: ~azure.mgmt.appconfiguration.models.Replica - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Replica or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Replica] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - replica_creation_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Replica]: - """Creates a replica with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :param replica_creation_parameters: The parameters for creating a replica. Required. - :type replica_creation_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Replica or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Replica] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - replica_creation_parameters: Union[_models.Replica, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Replica]: - """Creates a replica with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :param replica_creation_parameters: The parameters for creating a replica. Is either a Replica - type or a IO[bytes] type. Required. - :type replica_creation_parameters: ~azure.mgmt.appconfiguration.models.Replica or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Replica or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Replica] - :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.Replica] = 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_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - replica_creation_parameters=replica_creation_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Replica", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Replica].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Replica]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a replica. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_snapshots_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_snapshots_operations.py deleted file mode 100644 index 7c9656f8a4f9..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/operations/_snapshots_operations.py +++ /dev/null @@ -1,336 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._snapshots_operations import build_create_request, build_get_request -from .._configuration import AppConfigurationManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SnapshotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.aio.AppConfigurationManagementClient`'s - :attr:`snapshots` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, config_store_name: str, snapshot_name: str, **kwargs: Any - ) -> _models.Snapshot: - """Gets the properties of the specified snapshot. NOTE: This operation is intended for use in - Azure Resource Manager (ARM) Template deployments. For all other scenarios involving App - Configuration snapshots the data plane API should be used instead. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param snapshot_name: The name of the snapshot. Required. - :type snapshot_name: str - :return: Snapshot or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.Snapshot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - config_store_name: str, - snapshot_name: str, - body: Union[_models.Snapshot, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "Snapshot") - - _request = build_create_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - config_store_name: str, - snapshot_name: str, - body: _models.Snapshot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Creates a snapshot. NOTE: This operation is intended for use in Azure Resource Manager (ARM) - Template deployments. For all other scenarios involving App Configuration snapshots the data - plane API should be used instead. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param snapshot_name: The name of the snapshot. Required. - :type snapshot_name: str - :param body: The parameters for creating a snapshot. Required. - :type body: ~azure.mgmt.appconfiguration.models.Snapshot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - config_store_name: str, - snapshot_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Creates a snapshot. NOTE: This operation is intended for use in Azure Resource Manager (ARM) - Template deployments. For all other scenarios involving App Configuration snapshots the data - plane API should be used instead. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param snapshot_name: The name of the snapshot. Required. - :type snapshot_name: str - :param body: The parameters for creating a snapshot. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - config_store_name: str, - snapshot_name: str, - body: Union[_models.Snapshot, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Creates a snapshot. NOTE: This operation is intended for use in Azure Resource Manager (ARM) - Template deployments. For all other scenarios involving App Configuration snapshots the data - plane API should be used instead. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param snapshot_name: The name of the snapshot. Required. - :type snapshot_name: str - :param body: The parameters for creating a snapshot. Is either a Snapshot type or a IO[bytes] - type. Required. - :type body: ~azure.mgmt.appconfiguration.models.Snapshot or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appconfiguration.models.Snapshot] - :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.Snapshot] = 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_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - snapshot_name=snapshot_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Snapshot].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Snapshot]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py index 0f7bbc8bb5f3..285e58b8522d 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,55 +13,58 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore ApiKey, - ApiKeyListResult, + AzureFrontDoorProperties, CheckNameAvailabilityParameters, ConfigurationStore, - ConfigurationStoreListResult, + ConfigurationStoreProperties, + ConfigurationStorePropertiesUpdateParameters, ConfigurationStoreUpdateParameters, DataPlaneProxyProperties, DeletedConfigurationStore, - DeletedConfigurationStoreListResult, + DeletedConfigurationStoreProperties, EncryptionProperties, ErrorAdditionalInfo, ErrorDetail, - ErrorDetails, ErrorResponse, - ErrorResponseAutoGenerated, KeyValue, KeyValueFilter, - KeyValueListResult, + KeyValueProperties, KeyVaultProperties, LogSpecification, + ManagedOnBehalfOfConfiguration, MetricDimension, MetricSpecification, + MoboBrokerResource, NameAvailabilityStatus, OperationDefinition, OperationDefinitionDisplay, - OperationDefinitionListResult, OperationProperties, PrivateEndpoint, PrivateEndpointConnection, - PrivateEndpointConnectionListResult, + PrivateEndpointConnectionProperties, PrivateEndpointConnectionReference, PrivateLinkResource, - PrivateLinkResourceListResult, + PrivateLinkResourceProperties, PrivateLinkServiceConnectionState, + ProxyResource, RegenerateKeyParameters, Replica, - ReplicaListResult, + ReplicaProperties, Resource, ResourceIdentity, ServiceSpecification, Sku, Snapshot, + SnapshotProperties, SystemData, + TelemetryProperties, TrackedResource, UserIdentity, ) -from ._app_configuration_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore ActionsRequired, AuthenticationMode, CompositionType, @@ -82,48 +85,51 @@ __all__ = [ "ApiKey", - "ApiKeyListResult", + "AzureFrontDoorProperties", "CheckNameAvailabilityParameters", "ConfigurationStore", - "ConfigurationStoreListResult", + "ConfigurationStoreProperties", + "ConfigurationStorePropertiesUpdateParameters", "ConfigurationStoreUpdateParameters", "DataPlaneProxyProperties", "DeletedConfigurationStore", - "DeletedConfigurationStoreListResult", + "DeletedConfigurationStoreProperties", "EncryptionProperties", "ErrorAdditionalInfo", "ErrorDetail", - "ErrorDetails", "ErrorResponse", - "ErrorResponseAutoGenerated", "KeyValue", "KeyValueFilter", - "KeyValueListResult", + "KeyValueProperties", "KeyVaultProperties", "LogSpecification", + "ManagedOnBehalfOfConfiguration", "MetricDimension", "MetricSpecification", + "MoboBrokerResource", "NameAvailabilityStatus", "OperationDefinition", "OperationDefinitionDisplay", - "OperationDefinitionListResult", "OperationProperties", "PrivateEndpoint", "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionProperties", "PrivateEndpointConnectionReference", "PrivateLinkResource", - "PrivateLinkResourceListResult", + "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", + "ProxyResource", "RegenerateKeyParameters", "Replica", - "ReplicaListResult", + "ReplicaProperties", "Resource", "ResourceIdentity", "ServiceSpecification", "Sku", "Snapshot", + "SnapshotProperties", "SystemData", + "TelemetryProperties", "TrackedResource", "UserIdentity", "ActionsRequired", diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_app_configuration_management_client_enums.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_enums.py similarity index 86% rename from sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_app_configuration_management_client_enums.py rename to sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_enums.py index 895c3a9e616e..698c79d22fca 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_app_configuration_management_client_enums.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -26,9 +26,9 @@ class AuthenticationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The local authentication mode. Users are not required to have data plane permissions if local authentication is not disabled.""" PASS_THROUGH = "Pass-through" - """The pass-through authentication mode. User identity will be passed through from Azure Resource - Manager (ARM), requiring user to have data plane action permissions (Available via App - Configuration Data Owner/ App Configuration Data Reader).""" + """The pass-through authentication mode. User identity will be passed through from ARM, requiring + user to have data plane action permissions (Available via App Configuration Data Owner/ App + Configuration Data Reader).""" class CompositionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -57,12 +57,16 @@ class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -86,13 +90,11 @@ class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PrivateLinkDelegation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The data plane proxy private link delegation. This property manages if a request from delegated - Azure Resource Manager (ARM) private link is allowed when the data plane resource requires - private link. + ARM private link is allowed when the data plane resource requires private link. """ ENABLED = "Enabled" - """Azure Resource Manager (ARM) private endpoint is required if the resource requires private - link.""" + """ARM private endpoint is required if the resource requires private link.""" DISABLED = "Disabled" """Request is denied if the resource requires private link.""" diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py new file mode 100644 index 000000000000..dc60a4184291 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models.py @@ -0,0 +1,2241 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class ApiKey(_Model): + """An API key used for authenticating with a configuration store endpoint. + + :ivar id: The key ID. + :vartype id: str + :ivar name: A name for the key describing its usage. + :vartype name: str + :ivar value: The value of the key that is used for authentication purposes. + :vartype value: str + :ivar connection_string: A connection string that can be used by supporting clients for + authentication. + :vartype connection_string: str + :ivar last_modified: The last time any of the key's properties were modified. + :vartype last_modified: ~datetime.datetime + :ivar read_only: Whether this key can only be used for read operations. + :vartype read_only: bool + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The key ID.""" + name: Optional[str] = rest_field(visibility=["read"]) + """A name for the key describing its usage.""" + value: Optional[str] = rest_field(visibility=["read"]) + """The value of the key that is used for authentication purposes.""" + connection_string: Optional[str] = rest_field(name="connectionString", visibility=["read"]) + """A connection string that can be used by supporting clients for authentication.""" + last_modified: Optional[datetime.datetime] = rest_field(name="lastModified", visibility=["read"], format="rfc3339") + """The last time any of the key's properties were modified.""" + read_only: Optional[bool] = rest_field(name="readOnly", visibility=["read"]) + """Whether this key can only be used for read operations.""" + + +class AzureFrontDoorProperties(_Model): + """Azure Front Door settings. + + :ivar resource_id: Resource ID of an Azure Front Door profile. + :vartype resource_id: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource ID of an Azure Front Door profile.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityParameters(_Model): + """Parameters used for checking whether a resource name is available. + + :ivar name: The name to check for availability. Required. + :vartype name: str + :ivar type: The resource type to check for name availability. Required. + "Microsoft.AppConfiguration/configurationStores" + :vartype type: str or ~azure.mgmt.appconfiguration.models.ConfigurationResourceType + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name to check for availability. Required.""" + type: Union[str, "_models.ConfigurationResourceType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource type to check for name availability. Required. + \"Microsoft.AppConfiguration/configurationStores\"""" + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, "_models.ConfigurationResourceType"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """Tracked Resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConfigurationStore(TrackedResource): + """The configuration store along with all resource properties. The Configuration Store will have + all information to begin utilizing it. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The properties of a configuration store. + :vartype properties: ~azure.mgmt.appconfiguration.models.ConfigurationStoreProperties + :ivar identity: The managed identity information, if configured. + :vartype identity: ~azure.mgmt.appconfiguration.models.ResourceIdentity + :ivar sku: The sku of the configuration store. Required. + :vartype sku: ~azure.mgmt.appconfiguration.models.Sku + """ + + properties: Optional["_models.ConfigurationStoreProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a configuration store.""" + identity: Optional["_models.ResourceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed identity information, if configured.""" + sku: "_models.Sku" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The sku of the configuration store. Required.""" + + __flattened_items = [ + "provisioning_state", + "creation_date", + "endpoint", + "encryption", + "private_endpoint_connections", + "public_network_access", + "disable_local_auth", + "soft_delete_retention_in_days", + "default_key_value_revision_retention_period_in_seconds", + "enable_purge_protection", + "data_plane_proxy", + "create_mode", + "telemetry", + "managed_on_behalf_of_configuration", + "azure_front_door", + ] + + @overload + def __init__( + self, + *, + location: str, + sku: "_models.Sku", + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.ConfigurationStoreProperties"] = None, + identity: Optional["_models.ResourceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ConfigurationStoreProperties(_Model): + """The properties of a configuration store. + + :ivar provisioning_state: The provisioning state of the configuration store. Known values are: + "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.models.ProvisioningState + :ivar creation_date: The creation date of configuration store. + :vartype creation_date: ~datetime.datetime + :ivar endpoint: The DNS endpoint where the configuration store API will be available. + :vartype endpoint: str + :ivar encryption: The encryption settings of the configuration store. + :vartype encryption: ~azure.mgmt.appconfiguration.models.EncryptionProperties + :ivar private_endpoint_connections: The list of private endpoint connections that are set up + for this resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.appconfiguration.models.PrivateEndpointConnectionReference] + :ivar public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.appconfiguration.models.PublicNetworkAccess + :ivar disable_local_auth: Disables all authentication methods other than AAD authentication. + :vartype disable_local_auth: bool + :ivar soft_delete_retention_in_days: The amount of time in days that the configuration store + will be retained when it is soft deleted. + :vartype soft_delete_retention_in_days: int + :ivar default_key_value_revision_retention_period_in_seconds: The duration in seconds to retain + new key value revisions. Defaults to 604800 (7 days) for Free SKU stores and 2592000 (30 days) + for Standard SKU stores and Premium SKU stores. + :vartype default_key_value_revision_retention_period_in_seconds: int + :ivar enable_purge_protection: Property specifying whether protection against purge is enabled + for this configuration store. + :vartype enable_purge_protection: bool + :ivar data_plane_proxy: Property specifying the configuration of data plane proxy for Azure + Resource Manager (ARM). + :vartype data_plane_proxy: ~azure.mgmt.appconfiguration.models.DataPlaneProxyProperties + :ivar create_mode: Indicates whether the configuration store need to be recovered. Known values + are: "Recover" and "Default". + :vartype create_mode: str or ~azure.mgmt.appconfiguration.models.CreateMode + :ivar telemetry: Property specifying the configuration of telemetry for this configuration + store. + :vartype telemetry: ~azure.mgmt.appconfiguration.models.TelemetryProperties + :ivar managed_on_behalf_of_configuration: Managed On Behalf Of Configuration. + :vartype managed_on_behalf_of_configuration: + ~azure.mgmt.appconfiguration.models.ManagedOnBehalfOfConfiguration + :ivar azure_front_door: Property specifying the configuration of Azure Front Door for this + configuration store. + :vartype azure_front_door: ~azure.mgmt.appconfiguration.models.AzureFrontDoorProperties + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the configuration store. Known values are: \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339") + """The creation date of configuration store.""" + endpoint: Optional[str] = rest_field(visibility=["read"]) + """The DNS endpoint where the configuration store API will be available.""" + encryption: Optional["_models.EncryptionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The encryption settings of the configuration store.""" + private_endpoint_connections: Optional[list["_models.PrivateEndpointConnectionReference"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """The list of private endpoint connections that are set up for this resource.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Control permission for data plane traffic coming from public networks while private endpoint is + enabled. Known values are: \"Enabled\" and \"Disabled\".""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Disables all authentication methods other than AAD authentication.""" + soft_delete_retention_in_days: Optional[int] = rest_field( + name="softDeleteRetentionInDays", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of time in days that the configuration store will be retained when it is soft + deleted.""" + default_key_value_revision_retention_period_in_seconds: Optional[int] = rest_field( + name="defaultKeyValueRevisionRetentionPeriodInSeconds", + visibility=["read", "create", "update", "delete", "query"], + ) + """The duration in seconds to retain new key value revisions. Defaults to 604800 (7 days) for Free + SKU stores and 2592000 (30 days) for Standard SKU stores and Premium SKU stores.""" + enable_purge_protection: Optional[bool] = rest_field( + name="enablePurgeProtection", visibility=["read", "create", "update", "delete", "query"] + ) + """Property specifying whether protection against purge is enabled for this configuration store.""" + data_plane_proxy: Optional["_models.DataPlaneProxyProperties"] = rest_field( + name="dataPlaneProxy", visibility=["read", "create", "update", "delete", "query"] + ) + """Property specifying the configuration of data plane proxy for Azure Resource Manager (ARM).""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field(name="createMode", visibility=["create"]) + """Indicates whether the configuration store need to be recovered. Known values are: \"Recover\" + and \"Default\".""" + telemetry: Optional["_models.TelemetryProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Property specifying the configuration of telemetry for this configuration store.""" + managed_on_behalf_of_configuration: Optional["_models.ManagedOnBehalfOfConfiguration"] = rest_field( + name="managedOnBehalfOfConfiguration", visibility=["read"] + ) + """Managed On Behalf Of Configuration.""" + azure_front_door: Optional["_models.AzureFrontDoorProperties"] = rest_field( + name="azureFrontDoor", visibility=["read", "create", "update", "delete", "query"] + ) + """Property specifying the configuration of Azure Front Door for this configuration store.""" + + @overload + def __init__( + self, + *, + encryption: Optional["_models.EncryptionProperties"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + disable_local_auth: Optional[bool] = None, + soft_delete_retention_in_days: Optional[int] = None, + default_key_value_revision_retention_period_in_seconds: Optional[int] = None, + enable_purge_protection: Optional[bool] = None, + data_plane_proxy: Optional["_models.DataPlaneProxyProperties"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + telemetry: Optional["_models.TelemetryProperties"] = None, + azure_front_door: Optional["_models.AzureFrontDoorProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConfigurationStorePropertiesUpdateParameters(_Model): # pylint: disable=name-too-long + """The properties for updating a configuration store. + + :ivar encryption: The encryption settings of the configuration store. + :vartype encryption: ~azure.mgmt.appconfiguration.models.EncryptionProperties + :ivar disable_local_auth: Disables all authentication methods other than AAD authentication. + :vartype disable_local_auth: bool + :ivar public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.appconfiguration.models.PublicNetworkAccess + :ivar enable_purge_protection: Property specifying whether protection against purge is enabled + for this configuration store. + :vartype enable_purge_protection: bool + :ivar data_plane_proxy: Property specifying the configuration of data plane proxy for Azure + Resource Manager (ARM). + :vartype data_plane_proxy: ~azure.mgmt.appconfiguration.models.DataPlaneProxyProperties + :ivar default_key_value_revision_retention_period_in_seconds: The duration in seconds to retain + new key value revisions. Defaults to 604800 (7 days) for Free SKU stores and 2592000 (30 days) + for Standard SKU stores and Premium SKU stores. + :vartype default_key_value_revision_retention_period_in_seconds: int + :ivar telemetry: Property specifying the configuration of telemetry to update for this + configuration store. + :vartype telemetry: ~azure.mgmt.appconfiguration.models.TelemetryProperties + :ivar azure_front_door: Property specifying the configuration of Azure Front Door for this + configuration store. + :vartype azure_front_door: ~azure.mgmt.appconfiguration.models.AzureFrontDoorProperties + """ + + encryption: Optional["_models.EncryptionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The encryption settings of the configuration store.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Disables all authentication methods other than AAD authentication.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Control permission for data plane traffic coming from public networks while private endpoint is + enabled. Known values are: \"Enabled\" and \"Disabled\".""" + enable_purge_protection: Optional[bool] = rest_field( + name="enablePurgeProtection", visibility=["read", "create", "update", "delete", "query"] + ) + """Property specifying whether protection against purge is enabled for this configuration store.""" + data_plane_proxy: Optional["_models.DataPlaneProxyProperties"] = rest_field( + name="dataPlaneProxy", visibility=["read", "create", "update", "delete", "query"] + ) + """Property specifying the configuration of data plane proxy for Azure Resource Manager (ARM).""" + default_key_value_revision_retention_period_in_seconds: Optional[int] = rest_field( + name="defaultKeyValueRevisionRetentionPeriodInSeconds", + visibility=["read", "create", "update", "delete", "query"], + ) + """The duration in seconds to retain new key value revisions. Defaults to 604800 (7 days) for Free + SKU stores and 2592000 (30 days) for Standard SKU stores and Premium SKU stores.""" + telemetry: Optional["_models.TelemetryProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Property specifying the configuration of telemetry to update for this configuration store.""" + azure_front_door: Optional["_models.AzureFrontDoorProperties"] = rest_field( + name="azureFrontDoor", visibility=["read", "create", "update", "delete", "query"] + ) + """Property specifying the configuration of Azure Front Door for this configuration store.""" + + @overload + def __init__( + self, + *, + encryption: Optional["_models.EncryptionProperties"] = None, + disable_local_auth: Optional[bool] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + enable_purge_protection: Optional[bool] = None, + data_plane_proxy: Optional["_models.DataPlaneProxyProperties"] = None, + default_key_value_revision_retention_period_in_seconds: Optional[int] = None, + telemetry: Optional["_models.TelemetryProperties"] = None, + azure_front_door: Optional["_models.AzureFrontDoorProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConfigurationStoreUpdateParameters(_Model): + """The parameters for updating a configuration store. + + :ivar properties: The properties for updating a configuration store. + :vartype properties: + ~azure.mgmt.appconfiguration.models.ConfigurationStorePropertiesUpdateParameters + :ivar identity: The managed identity information for the configuration store. + :vartype identity: ~azure.mgmt.appconfiguration.models.ResourceIdentity + :ivar sku: The SKU of the configuration store. + :vartype sku: ~azure.mgmt.appconfiguration.models.Sku + :ivar tags: The ARM resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.ConfigurationStorePropertiesUpdateParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties for updating a configuration store.""" + identity: Optional["_models.ResourceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed identity information for the configuration store.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The SKU of the configuration store.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ARM resource tags.""" + + __flattened_items = [ + "encryption", + "disable_local_auth", + "public_network_access", + "enable_purge_protection", + "data_plane_proxy", + "default_key_value_revision_retention_period_in_seconds", + "telemetry", + "azure_front_door", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ConfigurationStorePropertiesUpdateParameters"] = None, + identity: Optional["_models.ResourceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DataPlaneProxyProperties(_Model): + """The data plane proxy settings for a configuration store. + + :ivar authentication_mode: The data plane proxy authentication mode. This property manages the + authentication mode of request to the data plane resources. Known values are: "Local" and + "Pass-through". + :vartype authentication_mode: str or ~azure.mgmt.appconfiguration.models.AuthenticationMode + :ivar private_link_delegation: The data plane proxy private link delegation. This property + manages if a request from delegated ARM private link is allowed when the data plane resource + requires private link. Known values are: "Enabled" and "Disabled". + :vartype private_link_delegation: str or + ~azure.mgmt.appconfiguration.models.PrivateLinkDelegation + """ + + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = rest_field( + name="authenticationMode", visibility=["read", "create", "update", "delete", "query"] + ) + """The data plane proxy authentication mode. This property manages the authentication mode of + request to the data plane resources. Known values are: \"Local\" and \"Pass-through\".""" + private_link_delegation: Optional[Union[str, "_models.PrivateLinkDelegation"]] = rest_field( + name="privateLinkDelegation", visibility=["read", "create", "update", "delete", "query"] + ) + """The data plane proxy private link delegation. This property manages if a request from delegated + ARM private link is allowed when the data plane resource requires private link. Known values + are: \"Enabled\" and \"Disabled\".""" + + @overload + def __init__( + self, + *, + authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = None, + private_link_delegation: Optional[Union[str, "_models.PrivateLinkDelegation"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProxyResource(Resource): + """Proxy Resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + """ + + +class DeletedConfigurationStore(ProxyResource): + """Deleted configuration store information with extended details. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + :ivar properties: Properties of the deleted configuration store. + :vartype properties: ~azure.mgmt.appconfiguration.models.DeletedConfigurationStoreProperties + """ + + properties: Optional["_models.DeletedConfigurationStoreProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the deleted configuration store.""" + + __flattened_items = [ + "configuration_store_id", + "location", + "deletion_date", + "scheduled_purge_date", + "tags", + "purge_protection_enabled", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.DeletedConfigurationStoreProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DeletedConfigurationStoreProperties(_Model): + """Properties of the deleted configuration store. + + :ivar configuration_store_id: The resource id of the original configuration store. + :vartype configuration_store_id: str + :ivar location: The location of the original configuration store. + :vartype location: str + :ivar deletion_date: The deleted date. + :vartype deletion_date: ~datetime.datetime + :ivar scheduled_purge_date: The scheduled purged date. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: Tags of the original configuration store. + :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original configuration store. + :vartype purge_protection_enabled: bool + """ + + configuration_store_id: Optional[str] = rest_field(name="configurationStoreId", visibility=["read"]) + """The resource id of the original configuration store.""" + location: Optional[str] = rest_field(visibility=["read"]) + """The location of the original configuration store.""" + deletion_date: Optional[datetime.datetime] = rest_field(name="deletionDate", visibility=["read"], format="rfc3339") + """The deleted date.""" + scheduled_purge_date: Optional[datetime.datetime] = rest_field( + name="scheduledPurgeDate", visibility=["read"], format="rfc3339" + ) + """The scheduled purged date.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read"]) + """Tags of the original configuration store.""" + purge_protection_enabled: Optional[bool] = rest_field(name="purgeProtectionEnabled", visibility=["read"]) + """Purge protection status of the original configuration store.""" + + +class EncryptionProperties(_Model): + """The encryption settings for a configuration store. + + :ivar key_vault_properties: Key vault properties. + :vartype key_vault_properties: ~azure.mgmt.appconfiguration.models.KeyVaultProperties + """ + + key_vault_properties: Optional["_models.KeyVaultProperties"] = rest_field( + name="keyVaultProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Key vault properties.""" + + @overload + def __init__( + self, + *, + key_vault_properties: Optional["_models.KeyVaultProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.appconfiguration.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.appconfiguration.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.appconfiguration.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyValue(ProxyResource): + """The key-value resource along with all resource properties. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + :ivar properties: All key-value properties. + :vartype properties: ~azure.mgmt.appconfiguration.models.KeyValueProperties + """ + + properties: Optional["_models.KeyValueProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """All key-value properties.""" + + __flattened_items = ["key", "label", "value", "content_type", "e_tag", "last_modified", "locked", "tags"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.KeyValueProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class KeyValueFilter(_Model): + """Enables filtering of key-values. + + :ivar key: Filters key-values by their key field. Required. + :vartype key: str + :ivar label: Filters key-values by their label field. + :vartype label: str + """ + + key: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Filters key-values by their key field. Required.""" + label: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Filters key-values by their label field.""" + + @overload + def __init__( + self, + *, + key: str, + label: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyValueProperties(_Model): + """All key-value properties. + + :ivar key: The primary identifier of a key-value. + The key is used in unison with the label to uniquely identify a key-value. + :vartype key: str + :ivar label: A value used to group key-values. + The label is used in unison with the key to uniquely identify a key-value. + :vartype label: str + :ivar value: The value of the key-value. + :vartype value: str + :ivar content_type: The content type of the key-value's value. + Providing a proper content-type can enable transformations of values when they are retrieved by + applications. + :vartype content_type: str + :ivar e_tag: An ETag indicating the state of a key-value within a configuration store. + :vartype e_tag: str + :ivar last_modified: The last time a modifying operation was performed on the given key-value. + :vartype last_modified: ~datetime.datetime + :ivar locked: A value indicating whether the key-value is locked. + A locked key-value may not be modified until it is unlocked. + :vartype locked: bool + :ivar tags: A dictionary of tags that can help identify what a key-value may be applicable for. + :vartype tags: dict[str, str] + """ + + key: Optional[str] = rest_field(visibility=["read"]) + """The primary identifier of a key-value. + The key is used in unison with the label to uniquely identify a key-value.""" + label: Optional[str] = rest_field(visibility=["read"]) + """A value used to group key-values. + The label is used in unison with the key to uniquely identify a key-value.""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The value of the key-value.""" + content_type: Optional[str] = rest_field( + name="contentType", visibility=["read", "create", "update", "delete", "query"] + ) + """The content type of the key-value's value. + Providing a proper content-type can enable transformations of values when they are retrieved by + applications.""" + e_tag: Optional[str] = rest_field(name="eTag", visibility=["read"]) + """An ETag indicating the state of a key-value within a configuration store.""" + last_modified: Optional[datetime.datetime] = rest_field(name="lastModified", visibility=["read"], format="rfc3339") + """The last time a modifying operation was performed on the given key-value.""" + locked: Optional[bool] = rest_field(visibility=["read"]) + """A value indicating whether the key-value is locked. + A locked key-value may not be modified until it is unlocked.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A dictionary of tags that can help identify what a key-value may be applicable for.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + content_type: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultProperties(_Model): + """Settings concerning key vault encryption for a configuration store. + + :ivar key_identifier: The URI of the key vault key used to encrypt data. + :vartype key_identifier: str + :ivar identity_client_id: The client id of the identity which will be used to access key vault. + :vartype identity_client_id: str + """ + + key_identifier: Optional[str] = rest_field( + name="keyIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """The URI of the key vault key used to encrypt data.""" + identity_client_id: Optional[str] = rest_field( + name="identityClientId", visibility=["read", "create", "update", "delete", "query"] + ) + """The client id of the identity which will be used to access key vault.""" + + @overload + def __init__( + self, + *, + key_identifier: Optional[str] = None, + identity_client_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LogSpecification(_Model): + """Specifications of the Log for Azure Monitoring. + + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the log.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Localized friendly display name of the log.""" + blob_duration: Optional[str] = rest_field( + name="blobDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Blob duration of the log.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedOnBehalfOfConfiguration(_Model): + """Managed-On-Behalf-Of configuration properties. This configuration exists for the resources + where a resource provider manages those resources on behalf of the resource owner. + + :ivar mobo_broker_resources: Managed-On-Behalf-Of broker resources. + :vartype mobo_broker_resources: list[~azure.mgmt.appconfiguration.models.MoboBrokerResource] + """ + + mobo_broker_resources: Optional[list["_models.MoboBrokerResource"]] = rest_field( + name="moboBrokerResources", visibility=["read"] + ) + """Managed-On-Behalf-Of broker resources.""" + + +class MetricDimension(_Model): + """Specifications of the Dimension of metrics. + + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar internal_name: Internal name of the dimension. + :vartype internal_name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the dimension.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Localized friendly display name of the dimension.""" + internal_name: Optional[str] = rest_field( + name="internalName", visibility=["read", "create", "update", "delete", "query"] + ) + """Internal name of the dimension.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + internal_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MetricSpecification(_Model): + """Specifications of the Metrics for Azure Monitoring. + + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :vartype aggregation_type: str + :ivar internal_metric_name: Internal metric name. + :vartype internal_metric_name: str + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appconfiguration.models.MetricDimension] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :vartype fill_gap_with_zero: bool + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the metric.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Localized friendly display name of the metric.""" + display_description: Optional[str] = rest_field( + name="displayDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """Localized friendly description of the metric.""" + unit: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Unit that makes sense for the metric.""" + aggregation_type: Optional[str] = rest_field( + name="aggregationType", visibility=["read", "create", "update", "delete", "query"] + ) + """Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count.""" + internal_metric_name: Optional[str] = rest_field( + name="internalMetricName", visibility=["read", "create", "update", "delete", "query"] + ) + """Internal metric name.""" + dimensions: Optional[list["_models.MetricDimension"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Dimensions of the metric.""" + fill_gap_with_zero: Optional[bool] = rest_field( + name="fillGapWithZero", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. If set to true, then zero will be returned for time duration where no metric is + emitted/published.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + internal_metric_name: Optional[str] = None, + dimensions: Optional[list["_models.MetricDimension"]] = None, + fill_gap_with_zero: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MoboBrokerResource(_Model): + """Managed-On-Behalf-Of broker resource. This resource is created by the Resource Provider to + manage some resources on behalf of the user. + + :ivar id: Resource identifier of a Managed-On-Behalf-Of broker resource. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource identifier of a Managed-On-Behalf-Of broker resource.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NameAvailabilityStatus(_Model): + """The result of a request to check the availability of a resource name. + + :ivar name_available: The value indicating whether the resource name is available. + :vartype name_available: bool + :ivar message: If any, the error message that provides more detail for the reason that the name + is not available. + :vartype message: str + :ivar reason: If any, the reason that the name is not available. + :vartype reason: str + """ + + name_available: Optional[bool] = rest_field(name="nameAvailable", visibility=["read"]) + """The value indicating whether the resource name is available.""" + message: Optional[str] = rest_field(visibility=["read"]) + """If any, the error message that provides more detail for the reason that the name is not + available.""" + reason: Optional[str] = rest_field(visibility=["read"]) + """If any, the reason that the name is not available.""" + + +class OperationDefinition(_Model): + """The definition of a configuration store operation. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: The display information for the configuration store operation. + :vartype display: ~azure.mgmt.appconfiguration.models.OperationDefinitionDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appconfiguration.models.OperationProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation name: {provider}/{resource}/{operation}.""" + is_data_action: Optional[bool] = rest_field( + name="isDataAction", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the operation is a data action.""" + display: Optional["_models.OperationDefinitionDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The display information for the configuration store operation.""" + origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Origin of the operation.""" + properties: Optional["_models.OperationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the operation.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["_models.OperationDefinitionDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["_models.OperationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDefinitionDisplay(_Model): + """The display information for a configuration store operation. + + :ivar provider: The resource provider name: Microsoft App Configuration.". + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The resource provider name: Microsoft App Configuration.\".""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource on which the operation is performed.""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The operation that users can perform.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description for the operation.""" + + @overload + def __init__( + self, + *, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationProperties(_Model): + """Extra Operation properties. + + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appconfiguration.models.ServiceSpecification + """ + + service_specification: Optional["_models.ServiceSpecification"] = rest_field( + name="serviceSpecification", visibility=["read", "create", "update", "delete", "query"] + ) + """Service specifications of the operation.""" + + @overload + def __init__( + self, + *, + service_specification: Optional["_models.ServiceSpecification"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpoint(_Model): + """Private endpoint which a connection belongs to. + + :ivar id: The resource Id for private endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource Id for private endpoint.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnection(ProxyResource): + """A private endpoint connection. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + :ivar properties: The properties of a private endpoint. + :vartype properties: ~azure.mgmt.appconfiguration.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a private endpoint.""" + + __flattened_items = ["provisioning_state", "private_endpoint", "private_link_service_connection_state"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateEndpointConnectionProperties(_Model): + """Properties of a private endpoint connection. + + :ivar provisioning_state: The provisioning status of the private endpoint connection. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.models.ProvisioningState + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: ~azure.mgmt.appconfiguration.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. Required. + :vartype private_link_service_connection_state: + ~azure.mgmt.appconfiguration.models.PrivateLinkServiceConnectionState + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning status of the private endpoint connection. Known values are: \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource of private endpoint.""" + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState" = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """A collection of information about the state of the connection between service consumer and + provider. Required.""" + + @overload + def __init__( + self, + *, + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnectionReference(_Model): + """A reference to a related private endpoint connection. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: The properties of a private endpoint connection. + :vartype properties: ~azure.mgmt.appconfiguration.models.PrivateEndpointConnectionProperties + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The resource ID.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource.""" + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a private endpoint connection.""" + + __flattened_items = ["provisioning_state", "private_endpoint", "private_link_service_connection_state"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateLinkResource(ProxyResource): + """A resource that supports private link capabilities. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + :ivar properties: Private link resource properties. + :vartype properties: ~azure.mgmt.appconfiguration.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Private link resource properties.""" + + __flattened_items = ["group_id", "required_members", "required_zone_names"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateLinkResourceProperties(_Model): + """Properties of a private link resource. + + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The list of required DNS zone names of the private link resource. + :vartype required_zone_names: list[str] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private link resource group id.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The private link resource required member names.""" + required_zone_names: Optional[list[str]] = rest_field(name="requiredZoneNames", visibility=["read"]) + """The list of required DNS zone names of the private link resource.""" + + +class PrivateLinkServiceConnectionState(_Model): + """The state of a private link service connection. + + :ivar status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", and "Disconnected". + :vartype status: str or ~azure.mgmt.appconfiguration.models.ConnectionStatus + :ivar description: The private link service connection description. + :vartype description: str + :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ + disconnect). Known values are: "None" and "Recreate". + :vartype actions_required: str or ~azure.mgmt.appconfiguration.models.ActionsRequired + """ + + status: Optional[Union[str, "_models.ConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The private link service connection status. Known values are: \"Pending\", \"Approved\", + \"Rejected\", and \"Disconnected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The private link service connection description.""" + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = rest_field( + name="actionsRequired", visibility=["read"] + ) + """Any action that is required beyond basic workflow (approve/ reject/ disconnect). Known values + are: \"None\" and \"Recreate\".""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegenerateKeyParameters(_Model): + """The parameters used to regenerate an API key. + + :ivar id: The id of the key to regenerate. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The id of the key to regenerate.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Replica(ProxyResource): + """The replica resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + :ivar properties: All replica properties. + :vartype properties: ~azure.mgmt.appconfiguration.models.ReplicaProperties + :ivar location: The location of the replica. + :vartype location: str + """ + + properties: Optional["_models.ReplicaProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """All replica properties.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The location of the replica.""" + + __flattened_items = ["endpoint", "provisioning_state"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ReplicaProperties"] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ReplicaProperties(_Model): + """All replica properties. + + :ivar endpoint: The URI of the replica where the replica API will be available. + :vartype endpoint: str + :ivar provisioning_state: The provisioning state of the replica. Known values are: "Creating", + "Succeeded", "Deleting", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appconfiguration.models.ReplicaProvisioningState + """ + + endpoint: Optional[str] = rest_field(visibility=["read"]) + """The URI of the replica where the replica API will be available.""" + provisioning_state: Optional[Union[str, "_models.ReplicaProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the replica. Known values are: \"Creating\", \"Succeeded\", + \"Deleting\", \"Failed\", and \"Canceled\".""" + + +class ResourceIdentity(_Model): + """An identity that can be associated with a resource. + + :ivar type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user-assigned identities. The type 'None' will + remove any identities. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned, UserAssigned". + :vartype type: str or ~azure.mgmt.appconfiguration.models.IdentityType + :ivar user_assigned_identities: The list of user-assigned identities associated with the + resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.appconfiguration.models.UserIdentity] + :ivar principal_id: The principal id of the identity. This property will only be provided for a + system-assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id associated with the resource's identity. This property will only + be provided for a system-assigned identity. + :vartype tenant_id: str + """ + + type: Optional[Union[str, "_models.IdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an + implicitly created identity and a set of user-assigned identities. The type 'None' will remove + any identities. Known values are: \"None\", \"SystemAssigned\", \"UserAssigned\", and + \"SystemAssigned, UserAssigned\".""" + user_assigned_identities: Optional[dict[str, "_models.UserIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of user-assigned identities associated with the resource. The user-assigned identity + dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.""" + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of the identity. This property will only be provided for a system-assigned + identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant id associated with the resource's identity. This property will only be provided for + a system-assigned identity.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.IdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceSpecification(_Model): + """Service specification payload. + + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appconfiguration.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appconfiguration.models.MetricSpecification] + """ + + log_specifications: Optional[list["_models.LogSpecification"]] = rest_field( + name="logSpecifications", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifications of the Log for Azure Monitoring.""" + metric_specifications: Optional[list["_models.MetricSpecification"]] = rest_field( + name="metricSpecifications", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifications of the Metrics for Azure Monitoring.""" + + @overload + def __init__( + self, + *, + log_specifications: Optional[list["_models.LogSpecification"]] = None, + metric_specifications: Optional[list["_models.MetricSpecification"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Sku(_Model): + """Describes a configuration store SKU. + + :ivar name: The SKU name of the configuration store. Required. + :vartype name: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The SKU name of the configuration store. Required.""" + + @overload + def __init__( + self, + *, + name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Snapshot(ProxyResource): + """The snapshot resource. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData + :ivar properties: All snapshot properties. + :vartype properties: ~azure.mgmt.appconfiguration.models.SnapshotProperties + """ + + properties: Optional["_models.SnapshotProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """All snapshot properties.""" + + __flattened_items = [ + "provisioning_state", + "status", + "filters", + "composition_type", + "created", + "expires", + "retention_period", + "size", + "items_count", + "tags", + "etag", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.SnapshotProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SnapshotProperties(_Model): + """All snapshot properties. + + :ivar provisioning_state: The provisioning state of the snapshot. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.models.ProvisioningState + :ivar status: The current status of the snapshot. Known values are: "Provisioning", "Ready", + "Archived", and "Failed". + :vartype status: str or ~azure.mgmt.appconfiguration.models.SnapshotStatus + :ivar filters: A list of filters used to filter the key-values included in the snapshot. + Required. + :vartype filters: list[~azure.mgmt.appconfiguration.models.KeyValueFilter] + :ivar composition_type: The composition type describes how the key-values within the snapshot + are composed. The 'key' composition type ensures there are no two key-values containing the + same key. The 'key_label' composition type ensures there are no two key-values containing the + same key and label. Known values are: "Key" and "Key_Label". + :vartype composition_type: str or ~azure.mgmt.appconfiguration.models.CompositionType + :ivar created: The time that the snapshot was created. + :vartype created: ~datetime.datetime + :ivar expires: The time that the snapshot will expire. + :vartype expires: ~datetime.datetime + :ivar retention_period: The amount of time, in seconds, that a snapshot will remain in the + archived state before expiring. This property is only writable during the creation of a + snapshot. If not specified, the default lifetime of key-value revisions will be used. + :vartype retention_period: int + :ivar size: The size in bytes of the snapshot. + :vartype size: int + :ivar items_count: The amount of key-values in the snapshot. + :vartype items_count: int + :ivar tags: The tags of the snapshot. NOTE: These are data plane tags, not ARM tags. + :vartype tags: dict[str, str] + :ivar etag: A value representing the current state of the snapshot. + :vartype etag: str + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the snapshot. Known values are: \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + status: Optional[Union[str, "_models.SnapshotStatus"]] = rest_field(visibility=["read"]) + """The current status of the snapshot. Known values are: \"Provisioning\", \"Ready\", + \"Archived\", and \"Failed\".""" + filters: list["_models.KeyValueFilter"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A list of filters used to filter the key-values included in the snapshot. Required.""" + composition_type: Optional[Union[str, "_models.CompositionType"]] = rest_field( + name="compositionType", visibility=["read", "create", "update", "delete", "query"] + ) + """The composition type describes how the key-values within the snapshot are composed. The 'key' + composition type ensures there are no two key-values containing the same key. The 'key_label' + composition type ensures there are no two key-values containing the same key and label. Known + values are: \"Key\" and \"Key_Label\".""" + created: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """The time that the snapshot was created.""" + expires: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """The time that the snapshot will expire.""" + retention_period: Optional[int] = rest_field(name="retentionPeriod", visibility=["read", "create"]) + """The amount of time, in seconds, that a snapshot will remain in the archived state before + expiring. This property is only writable during the creation of a snapshot. If not specified, + the default lifetime of key-value revisions will be used.""" + size: Optional[int] = rest_field(visibility=["read"]) + """The size in bytes of the snapshot.""" + items_count: Optional[int] = rest_field(name="itemsCount", visibility=["read"]) + """The amount of key-values in the snapshot.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags of the snapshot. NOTE: These are data plane tags, not ARM tags.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """A value representing the current state of the snapshot.""" + + @overload + def __init__( + self, + *, + filters: list["_models.KeyValueFilter"], + composition_type: Optional[Union[str, "_models.CompositionType"]] = None, + retention_period: Optional[int] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.appconfiguration.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.appconfiguration.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TelemetryProperties(_Model): + """Telemetry settings. + + :ivar resource_id: Resource ID of a resource enabling telemetry collection. + :vartype resource_id: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource ID of a resource enabling telemetry collection.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserIdentity(_Model): + """A resource identity that is managed by the user of the service. + + :ivar principal_id: The principal ID of the user-assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the user-assigned identity. + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the user-assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the user-assigned identity.""" diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py deleted file mode 100644 index 88d756a927e4..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_models_py3.py +++ /dev/null @@ -1,2085 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class ApiKey(_serialization.Model): - """An API key used for authenticating with a configuration store endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The key ID. - :vartype id: str - :ivar name: A name for the key describing its usage. - :vartype name: str - :ivar value: The value of the key that is used for authentication purposes. - :vartype value: str - :ivar connection_string: A connection string that can be used by supporting clients for - authentication. - :vartype connection_string: str - :ivar last_modified: The last time any of the key's properties were modified. - :vartype last_modified: ~datetime.datetime - :ivar read_only: Whether this key can only be used for read operations. - :vartype read_only: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "value": {"readonly": True}, - "connection_string": {"readonly": True}, - "last_modified": {"readonly": True}, - "read_only": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "connection_string": {"key": "connectionString", "type": "str"}, - "last_modified": {"key": "lastModified", "type": "iso-8601"}, - "read_only": {"key": "readOnly", "type": "bool"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.value: Optional[str] = None - self.connection_string: Optional[str] = None - self.last_modified: Optional[datetime.datetime] = None - self.read_only: Optional[bool] = None - - -class ApiKeyListResult(_serialization.Model): - """The result of a request to list API keys. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.appconfiguration.models.ApiKey] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ApiKey]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ApiKey"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.appconfiguration.models.ApiKey] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CheckNameAvailabilityParameters(_serialization.Model): - """Parameters used for checking whether a resource name is available. - - All required parameters must be populated in order to send to server. - - :ivar name: The name to check for availability. Required. - :vartype name: str - :ivar type: The resource type to check for name availability. Required. - "Microsoft.AppConfiguration/configurationStores" - :vartype type: str or ~azure.mgmt.appconfiguration.models.ConfigurationResourceType - """ - - _validation = { - "name": {"required": True}, - "type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: str, type: Union[str, "_models.ConfigurationResourceType"], **kwargs: Any) -> None: - """ - :keyword name: The name to check for availability. Required. - :paramtype name: str - :keyword type: The resource type to check for name availability. Required. - "Microsoft.AppConfiguration/configurationStores" - :paramtype type: str or ~azure.mgmt.appconfiguration.models.ConfigurationResourceType - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: 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 - """ - - _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"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class ConfigurationStore(TrackedResource): - """The configuration store along with all resource properties. The Configuration Store will have - all information to begin utilizing it. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: The managed identity information, if configured. - :vartype identity: ~azure.mgmt.appconfiguration.models.ResourceIdentity - :ivar sku: The sku of the configuration store. Required. - :vartype sku: ~azure.mgmt.appconfiguration.models.Sku - :ivar system_data: Resource system metadata. - :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData - :ivar provisioning_state: The provisioning state of the configuration store. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.models.ProvisioningState - :ivar creation_date: The creation date of configuration store. - :vartype creation_date: ~datetime.datetime - :ivar endpoint: The DNS endpoint where the configuration store API will be available. - :vartype endpoint: str - :ivar encryption: The encryption settings of the configuration store. - :vartype encryption: ~azure.mgmt.appconfiguration.models.EncryptionProperties - :ivar private_endpoint_connections: The list of private endpoint connections that are set up - for this resource. - :vartype private_endpoint_connections: - list[~azure.mgmt.appconfiguration.models.PrivateEndpointConnectionReference] - :ivar public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.appconfiguration.models.PublicNetworkAccess - :ivar disable_local_auth: Disables all authentication methods other than AAD authentication. - :vartype disable_local_auth: bool - :ivar soft_delete_retention_in_days: The amount of time in days that the configuration store - will be retained when it is soft deleted. - :vartype soft_delete_retention_in_days: int - :ivar default_key_value_revision_retention_period_in_seconds: The duration in seconds to retain - new key value revisions. Defaults to 604800 (7 days) for Free SKU stores and 2592000 (30 days) - for Standard SKU stores and Premium SKU stores. - :vartype default_key_value_revision_retention_period_in_seconds: int - :ivar enable_purge_protection: Property specifying whether protection against purge is enabled - for this configuration store. - :vartype enable_purge_protection: bool - :ivar data_plane_proxy: Property specifying the configuration of data plane proxy for Azure - Resource Manager (ARM). - :vartype data_plane_proxy: ~azure.mgmt.appconfiguration.models.DataPlaneProxyProperties - :ivar create_mode: Indicates whether the configuration store need to be recovered. Known values - are: "Recover" and "Default". - :vartype create_mode: str or ~azure.mgmt.appconfiguration.models.CreateMode - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "sku": {"required": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "creation_date": {"readonly": True}, - "endpoint": {"readonly": True}, - "private_endpoint_connections": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceIdentity"}, - "sku": {"key": "sku", "type": "Sku"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, - "endpoint": {"key": "properties.endpoint", "type": "str"}, - "encryption": {"key": "properties.encryption", "type": "EncryptionProperties"}, - "private_endpoint_connections": { - "key": "properties.privateEndpointConnections", - "type": "[PrivateEndpointConnectionReference]", - }, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, - "soft_delete_retention_in_days": {"key": "properties.softDeleteRetentionInDays", "type": "int"}, - "default_key_value_revision_retention_period_in_seconds": { - "key": "properties.defaultKeyValueRevisionRetentionPeriodInSeconds", - "type": "int", - }, - "enable_purge_protection": {"key": "properties.enablePurgeProtection", "type": "bool"}, - "data_plane_proxy": {"key": "properties.dataPlaneProxy", "type": "DataPlaneProxyProperties"}, - "create_mode": {"key": "properties.createMode", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - sku: "_models.Sku", - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ResourceIdentity"] = None, - encryption: Optional["_models.EncryptionProperties"] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - disable_local_auth: bool = False, - soft_delete_retention_in_days: int = 7, - default_key_value_revision_retention_period_in_seconds: Optional[int] = None, - enable_purge_protection: bool = False, - data_plane_proxy: Optional["_models.DataPlaneProxyProperties"] = None, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: The managed identity information, if configured. - :paramtype identity: ~azure.mgmt.appconfiguration.models.ResourceIdentity - :keyword sku: The sku of the configuration store. Required. - :paramtype sku: ~azure.mgmt.appconfiguration.models.Sku - :keyword encryption: The encryption settings of the configuration store. - :paramtype encryption: ~azure.mgmt.appconfiguration.models.EncryptionProperties - :keyword public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.appconfiguration.models.PublicNetworkAccess - :keyword disable_local_auth: Disables all authentication methods other than AAD authentication. - :paramtype disable_local_auth: bool - :keyword soft_delete_retention_in_days: The amount of time in days that the configuration store - will be retained when it is soft deleted. - :paramtype soft_delete_retention_in_days: int - :keyword default_key_value_revision_retention_period_in_seconds: The duration in seconds to - retain new key value revisions. Defaults to 604800 (7 days) for Free SKU stores and 2592000 (30 - days) for Standard SKU stores and Premium SKU stores. - :paramtype default_key_value_revision_retention_period_in_seconds: int - :keyword enable_purge_protection: Property specifying whether protection against purge is - enabled for this configuration store. - :paramtype enable_purge_protection: bool - :keyword data_plane_proxy: Property specifying the configuration of data plane proxy for Azure - Resource Manager (ARM). - :paramtype data_plane_proxy: ~azure.mgmt.appconfiguration.models.DataPlaneProxyProperties - :keyword create_mode: Indicates whether the configuration store need to be recovered. Known - values are: "Recover" and "Default". - :paramtype create_mode: str or ~azure.mgmt.appconfiguration.models.CreateMode - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.sku = sku - self.system_data: Optional["_models.SystemData"] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.creation_date: Optional[datetime.datetime] = None - self.endpoint: Optional[str] = None - self.encryption = encryption - self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnectionReference"]] = None - self.public_network_access = public_network_access - self.disable_local_auth = disable_local_auth - self.soft_delete_retention_in_days = soft_delete_retention_in_days - self.default_key_value_revision_retention_period_in_seconds = ( - default_key_value_revision_retention_period_in_seconds - ) - self.enable_purge_protection = enable_purge_protection - self.data_plane_proxy = data_plane_proxy - self.create_mode = create_mode - - -class ConfigurationStoreListResult(_serialization.Model): - """The result of a request to list configuration stores. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ConfigurationStore]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ConfigurationStore"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationStoreUpdateParameters(_serialization.Model): - """The parameters for updating a configuration store. - - :ivar identity: The managed identity information for the configuration store. - :vartype identity: ~azure.mgmt.appconfiguration.models.ResourceIdentity - :ivar sku: The SKU of the configuration store. - :vartype sku: ~azure.mgmt.appconfiguration.models.Sku - :ivar tags: The ARM resource tags. - :vartype tags: dict[str, str] - :ivar encryption: The encryption settings of the configuration store. - :vartype encryption: ~azure.mgmt.appconfiguration.models.EncryptionProperties - :ivar disable_local_auth: Disables all authentication methods other than AAD authentication. - :vartype disable_local_auth: bool - :ivar public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.appconfiguration.models.PublicNetworkAccess - :ivar enable_purge_protection: Property specifying whether protection against purge is enabled - for this configuration store. - :vartype enable_purge_protection: bool - :ivar data_plane_proxy: Property specifying the configuration of data plane proxy for Azure - Resource Manager (ARM). - :vartype data_plane_proxy: ~azure.mgmt.appconfiguration.models.DataPlaneProxyProperties - :ivar default_key_value_revision_retention_period_in_seconds: The duration in seconds to retain - new key value revisions. Defaults to 604800 (7 days) for Free SKU stores and 2592000 (30 days) - for Standard SKU stores and Premium SKU stores. - :vartype default_key_value_revision_retention_period_in_seconds: int - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "ResourceIdentity"}, - "sku": {"key": "sku", "type": "Sku"}, - "tags": {"key": "tags", "type": "{str}"}, - "encryption": {"key": "properties.encryption", "type": "EncryptionProperties"}, - "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "enable_purge_protection": {"key": "properties.enablePurgeProtection", "type": "bool"}, - "data_plane_proxy": {"key": "properties.dataPlaneProxy", "type": "DataPlaneProxyProperties"}, - "default_key_value_revision_retention_period_in_seconds": { - "key": "properties.defaultKeyValueRevisionRetentionPeriodInSeconds", - "type": "int", - }, - } - - def __init__( - self, - *, - identity: Optional["_models.ResourceIdentity"] = None, - sku: Optional["_models.Sku"] = None, - tags: Optional[Dict[str, str]] = None, - encryption: Optional["_models.EncryptionProperties"] = None, - disable_local_auth: Optional[bool] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - enable_purge_protection: Optional[bool] = None, - data_plane_proxy: Optional["_models.DataPlaneProxyProperties"] = None, - default_key_value_revision_retention_period_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: The managed identity information for the configuration store. - :paramtype identity: ~azure.mgmt.appconfiguration.models.ResourceIdentity - :keyword sku: The SKU of the configuration store. - :paramtype sku: ~azure.mgmt.appconfiguration.models.Sku - :keyword tags: The ARM resource tags. - :paramtype tags: dict[str, str] - :keyword encryption: The encryption settings of the configuration store. - :paramtype encryption: ~azure.mgmt.appconfiguration.models.EncryptionProperties - :keyword disable_local_auth: Disables all authentication methods other than AAD authentication. - :paramtype disable_local_auth: bool - :keyword public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.appconfiguration.models.PublicNetworkAccess - :keyword enable_purge_protection: Property specifying whether protection against purge is - enabled for this configuration store. - :paramtype enable_purge_protection: bool - :keyword data_plane_proxy: Property specifying the configuration of data plane proxy for Azure - Resource Manager (ARM). - :paramtype data_plane_proxy: ~azure.mgmt.appconfiguration.models.DataPlaneProxyProperties - :keyword default_key_value_revision_retention_period_in_seconds: The duration in seconds to - retain new key value revisions. Defaults to 604800 (7 days) for Free SKU stores and 2592000 (30 - days) for Standard SKU stores and Premium SKU stores. - :paramtype default_key_value_revision_retention_period_in_seconds: int - """ - super().__init__(**kwargs) - self.identity = identity - self.sku = sku - self.tags = tags - self.encryption = encryption - self.disable_local_auth = disable_local_auth - self.public_network_access = public_network_access - self.enable_purge_protection = enable_purge_protection - self.data_plane_proxy = data_plane_proxy - self.default_key_value_revision_retention_period_in_seconds = ( - default_key_value_revision_retention_period_in_seconds - ) - - -class DataPlaneProxyProperties(_serialization.Model): - """The data plane proxy settings for a configuration store. - - :ivar authentication_mode: The data plane proxy authentication mode. This property manages the - authentication mode of request to the data plane resources. Known values are: "Local" and - "Pass-through". - :vartype authentication_mode: str or ~azure.mgmt.appconfiguration.models.AuthenticationMode - :ivar private_link_delegation: The data plane proxy private link delegation. This property - manages if a request from delegated Azure Resource Manager (ARM) private link is allowed when - the data plane resource requires private link. Known values are: "Enabled" and "Disabled". - :vartype private_link_delegation: str or - ~azure.mgmt.appconfiguration.models.PrivateLinkDelegation - """ - - _attribute_map = { - "authentication_mode": {"key": "authenticationMode", "type": "str"}, - "private_link_delegation": {"key": "privateLinkDelegation", "type": "str"}, - } - - def __init__( - self, - *, - authentication_mode: Optional[Union[str, "_models.AuthenticationMode"]] = None, - private_link_delegation: Optional[Union[str, "_models.PrivateLinkDelegation"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword authentication_mode: The data plane proxy authentication mode. This property manages - the authentication mode of request to the data plane resources. Known values are: "Local" and - "Pass-through". - :paramtype authentication_mode: str or ~azure.mgmt.appconfiguration.models.AuthenticationMode - :keyword private_link_delegation: The data plane proxy private link delegation. This property - manages if a request from delegated Azure Resource Manager (ARM) private link is allowed when - the data plane resource requires private link. Known values are: "Enabled" and "Disabled". - :paramtype private_link_delegation: str or - ~azure.mgmt.appconfiguration.models.PrivateLinkDelegation - """ - super().__init__(**kwargs) - self.authentication_mode = authentication_mode - self.private_link_delegation = private_link_delegation - - -class DeletedConfigurationStore(_serialization.Model): - """Deleted configuration store information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID for the deleted configuration store. - :vartype id: str - :ivar name: The name of the configuration store. - :vartype name: str - :ivar type: The resource type of the configuration store. - :vartype type: str - :ivar configuration_store_id: The resource id of the original configuration store. - :vartype configuration_store_id: str - :ivar location: The location of the original configuration store. - :vartype location: str - :ivar deletion_date: The deleted date. - :vartype deletion_date: ~datetime.datetime - :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: ~datetime.datetime - :ivar tags: Tags of the original configuration store. - :vartype tags: dict[str, str] - :ivar purge_protection_enabled: Purge protection status of the original configuration store. - :vartype purge_protection_enabled: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "configuration_store_id": {"readonly": True}, - "location": {"readonly": True}, - "deletion_date": {"readonly": True}, - "scheduled_purge_date": {"readonly": True}, - "tags": {"readonly": True}, - "purge_protection_enabled": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "configuration_store_id": {"key": "properties.configurationStoreId", "type": "str"}, - "location": {"key": "properties.location", "type": "str"}, - "deletion_date": {"key": "properties.deletionDate", "type": "iso-8601"}, - "scheduled_purge_date": {"key": "properties.scheduledPurgeDate", "type": "iso-8601"}, - "tags": {"key": "properties.tags", "type": "{str}"}, - "purge_protection_enabled": {"key": "properties.purgeProtectionEnabled", "type": "bool"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.configuration_store_id: Optional[str] = None - self.location: Optional[str] = None - self.deletion_date: Optional[datetime.datetime] = None - self.scheduled_purge_date: Optional[datetime.datetime] = None - self.tags: Optional[Dict[str, str]] = None - self.purge_protection_enabled: Optional[bool] = None - - -class DeletedConfigurationStoreListResult(_serialization.Model): - """List of deleted configuration stores. - - :ivar value: The list of deleted configuration store. - :vartype value: list[~azure.mgmt.appconfiguration.models.DeletedConfigurationStore] - :ivar next_link: The URL to get the next set of deleted configuration stores. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DeletedConfigurationStore]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.DeletedConfigurationStore"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of deleted configuration store. - :paramtype value: list[~azure.mgmt.appconfiguration.models.DeletedConfigurationStore] - :keyword next_link: The URL to get the next set of deleted configuration stores. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class EncryptionProperties(_serialization.Model): - """The encryption settings for a configuration store. - - :ivar key_vault_properties: Key vault properties. - :vartype key_vault_properties: ~azure.mgmt.appconfiguration.models.KeyVaultProperties - """ - - _attribute_map = { - "key_vault_properties": {"key": "keyVaultProperties", "type": "KeyVaultProperties"}, - } - - def __init__(self, *, key_vault_properties: Optional["_models.KeyVaultProperties"] = None, **kwargs: Any) -> None: - """ - :keyword key_vault_properties: Key vault properties. - :paramtype key_vault_properties: ~azure.mgmt.appconfiguration.models.KeyVaultProperties - """ - super().__init__(**kwargs) - self.key_vault_properties = key_vault_properties - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.info: Optional[JSON] = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.appconfiguration.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.appconfiguration.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.target: Optional[str] = None - self.details: Optional[List["_models.ErrorDetail"]] = None - self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None - - -class ErrorDetails(_serialization.Model): - """The details of the error. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.appconfiguration.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None - - -class ErrorResponse(_serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The - reason is provided in the error message. - - :ivar error: The details of the error. - :vartype error: ~azure.mgmt.appconfiguration.models.ErrorDetails - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetails"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs: Any) -> None: - """ - :keyword error: The details of the error. - :paramtype error: ~azure.mgmt.appconfiguration.models.ErrorDetails - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorResponseAutoGenerated(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.appconfiguration.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.appconfiguration.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class KeyValue(_serialization.Model): - """The key-value resource along with all resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar key: The primary identifier of a key-value. - The key is used in unison with the label to uniquely identify a key-value. - :vartype key: str - :ivar label: A value used to group key-values. - The label is used in unison with the key to uniquely identify a key-value. - :vartype label: str - :ivar value: The value of the key-value. - :vartype value: str - :ivar content_type: The content type of the key-value's value. - Providing a proper content-type can enable transformations of values when they are retrieved by - applications. - :vartype content_type: str - :ivar e_tag: An ETag indicating the state of a key-value within a configuration store. - :vartype e_tag: str - :ivar last_modified: The last time a modifying operation was performed on the given key-value. - :vartype last_modified: ~datetime.datetime - :ivar locked: A value indicating whether the key-value is locked. - A locked key-value may not be modified until it is unlocked. - :vartype locked: bool - :ivar tags: A dictionary of tags that can help identify what a key-value may be applicable for. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "key": {"readonly": True}, - "label": {"readonly": True}, - "e_tag": {"readonly": True}, - "last_modified": {"readonly": True}, - "locked": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "key": {"key": "properties.key", "type": "str"}, - "label": {"key": "properties.label", "type": "str"}, - "value": {"key": "properties.value", "type": "str"}, - "content_type": {"key": "properties.contentType", "type": "str"}, - "e_tag": {"key": "properties.eTag", "type": "str"}, - "last_modified": {"key": "properties.lastModified", "type": "iso-8601"}, - "locked": {"key": "properties.locked", "type": "bool"}, - "tags": {"key": "properties.tags", "type": "{str}"}, - } - - def __init__( - self, - *, - value: Optional[str] = None, - content_type: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The value of the key-value. - :paramtype value: str - :keyword content_type: The content type of the key-value's value. - Providing a proper content-type can enable transformations of values when they are retrieved by - applications. - :paramtype content_type: str - :keyword tags: A dictionary of tags that can help identify what a key-value may be applicable - for. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.key: Optional[str] = None - self.label: Optional[str] = None - self.value = value - self.content_type = content_type - self.e_tag: Optional[str] = None - self.last_modified: Optional[datetime.datetime] = None - self.locked: Optional[bool] = None - self.tags = tags - - -class KeyValueFilter(_serialization.Model): - """Enables filtering of key-values. - - All required parameters must be populated in order to send to server. - - :ivar key: Filters key-values by their key field. Required. - :vartype key: str - :ivar label: Filters key-values by their label field. - :vartype label: str - """ - - _validation = { - "key": {"required": True}, - } - - _attribute_map = { - "key": {"key": "key", "type": "str"}, - "label": {"key": "label", "type": "str"}, - } - - def __init__(self, *, key: str, label: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword key: Filters key-values by their key field. Required. - :paramtype key: str - :keyword label: Filters key-values by their label field. - :paramtype label: str - """ - super().__init__(**kwargs) - self.key = key - self.label = label - - -class KeyValueListResult(_serialization.Model): - """The result of a request to list key-values. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.appconfiguration.models.KeyValue] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[KeyValue]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.KeyValue"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.appconfiguration.models.KeyValue] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class KeyVaultProperties(_serialization.Model): - """Settings concerning key vault encryption for a configuration store. - - :ivar key_identifier: The URI of the key vault key used to encrypt data. - :vartype key_identifier: str - :ivar identity_client_id: The client id of the identity which will be used to access key vault. - :vartype identity_client_id: str - """ - - _attribute_map = { - "key_identifier": {"key": "keyIdentifier", "type": "str"}, - "identity_client_id": {"key": "identityClientId", "type": "str"}, - } - - def __init__( - self, *, key_identifier: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword key_identifier: The URI of the key vault key used to encrypt data. - :paramtype key_identifier: str - :keyword identity_client_id: The client id of the identity which will be used to access key - vault. - :paramtype identity_client_id: str - """ - super().__init__(**kwargs) - self.key_identifier = key_identifier - self.identity_client_id = identity_client_id - - -class LogSpecification(_serialization.Model): - """Specifications of the Log for Azure Monitoring. - - :ivar name: Name of the log. - :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "blob_duration": {"key": "blobDuration", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - blob_duration: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class MetricDimension(_serialization.Model): - """Specifications of the Dimension of metrics. - - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar internal_name: Internal name of the dimension. - :vartype internal_name: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "internal_name": {"key": "internalName", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - internal_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword internal_name: Internal name of the dimension. - :paramtype internal_name: str - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.internal_name = internal_name - - -class MetricSpecification(_serialization.Model): - """Specifications of the Metrics for Azure Monitoring. - - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :vartype aggregation_type: str - :ivar internal_metric_name: Internal metric name. - :vartype internal_metric_name: str - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.appconfiguration.models.MetricDimension] - :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :vartype fill_gap_with_zero: bool - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "display_description": {"key": "displayDescription", "type": "str"}, - "unit": {"key": "unit", "type": "str"}, - "aggregation_type": {"key": "aggregationType", "type": "str"}, - "internal_metric_name": {"key": "internalMetricName", "type": "str"}, - "dimensions": {"key": "dimensions", "type": "[MetricDimension]"}, - "fill_gap_with_zero": {"key": "fillGapWithZero", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - display_description: Optional[str] = None, - unit: Optional[str] = None, - aggregation_type: Optional[str] = None, - internal_metric_name: Optional[str] = None, - dimensions: Optional[List["_models.MetricDimension"]] = None, - fill_gap_with_zero: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword internal_metric_name: Internal metric name. - :paramtype internal_metric_name: str - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.appconfiguration.models.MetricDimension] - :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :paramtype fill_gap_with_zero: bool - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.display_description = display_description - self.unit = unit - self.aggregation_type = aggregation_type - self.internal_metric_name = internal_metric_name - self.dimensions = dimensions - self.fill_gap_with_zero = fill_gap_with_zero - - -class NameAvailabilityStatus(_serialization.Model): - """The result of a request to check the availability of a resource name. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: The value indicating whether the resource name is available. - :vartype name_available: bool - :ivar message: If any, the error message that provides more detail for the reason that the name - is not available. - :vartype message: str - :ivar reason: If any, the reason that the name is not available. - :vartype reason: str - """ - - _validation = { - "name_available": {"readonly": True}, - "message": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "message": {"key": "message", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name_available: Optional[bool] = None - self.message: Optional[str] = None - self.reason: Optional[str] = None - - -class OperationDefinition(_serialization.Model): - """The definition of a configuration store operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool - :ivar display: The display information for the configuration store operation. - :vartype display: ~azure.mgmt.appconfiguration.models.OperationDefinitionDisplay - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appconfiguration.models.OperationProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDefinitionDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "OperationProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDefinitionDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["_models.OperationProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - :keyword display: The display information for the configuration store operation. - :paramtype display: ~azure.mgmt.appconfiguration.models.OperationDefinitionDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appconfiguration.models.OperationProperties - """ - super().__init__(**kwargs) - self.name = name - self.is_data_action = is_data_action - self.display = display - self.origin = origin - self.properties = properties - - -class OperationDefinitionDisplay(_serialization.Model): - """The display information for a configuration store operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The resource provider name: Microsoft App Configuration.". - :vartype provider: str - :ivar resource: The resource on which the operation is performed. - :vartype resource: str - :ivar operation: The operation that users can perform. - :vartype operation: str - :ivar description: The description for the operation. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword resource: The resource on which the operation is performed. - :paramtype resource: str - :keyword operation: The operation that users can perform. - :paramtype operation: str - :keyword description: The description for the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider: Optional[str] = None - self.resource = resource - self.operation = operation - self.description = description - - -class OperationDefinitionListResult(_serialization.Model): - """The result of a request to list configuration store operations. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.appconfiguration.models.OperationDefinition] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationDefinition]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.OperationDefinition"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.appconfiguration.models.OperationDefinition] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OperationProperties(_serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: ~azure.mgmt.appconfiguration.models.ServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: ~azure.mgmt.appconfiguration.models.ServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class PrivateEndpoint(_serialization.Model): - """Private endpoint which a connection belongs to. - - :ivar id: The resource Id for private endpoint. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The resource Id for private endpoint. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class PrivateEndpointConnection(_serialization.Model): - """A private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar provisioning_state: The provisioning status of the private endpoint connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.models.ProvisioningState - :ivar private_endpoint: The resource of private endpoint. - :vartype private_endpoint: ~azure.mgmt.appconfiguration.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.appconfiguration.models.PrivateLinkServiceConnectionState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: The resource of private endpoint. - :paramtype private_endpoint: ~azure.mgmt.appconfiguration.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.appconfiguration.models.PrivateLinkServiceConnectionState - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """A list of private endpoint connections. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PrivateEndpointConnectionReference(_serialization.Model): - """A reference to a related private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar provisioning_state: The provisioning status of the private endpoint connection. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.models.ProvisioningState - :ivar private_endpoint: The resource of private endpoint. - :vartype private_endpoint: ~azure.mgmt.appconfiguration.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.appconfiguration.models.PrivateLinkServiceConnectionState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: The resource of private endpoint. - :paramtype private_endpoint: ~azure.mgmt.appconfiguration.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.appconfiguration.models.PrivateLinkServiceConnectionState - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - - -class PrivateLinkResource(_serialization.Model): - """A resource that supports private link capabilities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The list of required DNS zone names of the private link resource. - :vartype required_zone_names: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, - "required_zone_names": {"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"}, - "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, - "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.group_id: Optional[str] = None - self.required_members: Optional[List[str]] = None - self.required_zone_names: Optional[List[str]] = None - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.appconfiguration.models.PrivateLinkResource] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.PrivateLinkResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.appconfiguration.models.PrivateLinkResource] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PrivateLinkServiceConnectionState(_serialization.Model): - """The state of a private link service connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", and "Disconnected". - :vartype status: str or ~azure.mgmt.appconfiguration.models.ConnectionStatus - :ivar description: The private link service connection description. - :vartype description: str - :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ - disconnect). Known values are: "None" and "Recreate". - :vartype actions_required: str or ~azure.mgmt.appconfiguration.models.ActionsRequired - """ - - _validation = { - "actions_required": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, - } - - def __init__( - self, - *, - status: Optional[Union[str, "_models.ConnectionStatus"]] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword status: The private link service connection status. Known values are: "Pending", - "Approved", "Rejected", and "Disconnected". - :paramtype status: str or ~azure.mgmt.appconfiguration.models.ConnectionStatus - :keyword description: The private link service connection description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None - - -class RegenerateKeyParameters(_serialization.Model): - """The parameters used to regenerate an API key. - - :ivar id: The id of the key to regenerate. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The id of the key to regenerate. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class Replica(_serialization.Model): - """The replica resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the replica. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar location: The location of the replica. - :vartype location: str - :ivar system_data: Resource system metadata. - :vartype system_data: ~azure.mgmt.appconfiguration.models.SystemData - :ivar endpoint: The URI of the replica where the replica API will be available. - :vartype endpoint: str - :ivar provisioning_state: The provisioning state of the replica. Known values are: "Creating", - "Succeeded", "Deleting", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.appconfiguration.models.ReplicaProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "endpoint": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "endpoint": {"key": "properties.endpoint", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword location: The location of the replica. - :paramtype location: str - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.system_data: Optional["_models.SystemData"] = None - self.endpoint: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.ReplicaProvisioningState"]] = None - - -class ReplicaListResult(_serialization.Model): - """The result of a request to list replicas. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.appconfiguration.models.Replica] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Replica]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Replica"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.appconfiguration.models.Replica] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceIdentity(_serialization.Model): - """An identity that can be associated with a resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes - both an implicitly created identity and a set of user-assigned identities. The type 'None' will - remove any identities. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :vartype type: str or ~azure.mgmt.appconfiguration.models.IdentityType - :ivar user_assigned_identities: The list of user-assigned identities associated with the - resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :vartype user_assigned_identities: dict[str, ~azure.mgmt.appconfiguration.models.UserIdentity] - :ivar principal_id: The principal id of the identity. This property will only be provided for a - system-assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the resource's identity. This property will only - be provided for a system-assigned identity. - :vartype tenant_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserIdentity}"}, - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.IdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of managed identity used. The type 'SystemAssigned, UserAssigned' - includes both an implicitly created identity and a set of user-assigned identities. The type - 'None' will remove any identities. Known values are: "None", "SystemAssigned", "UserAssigned", - and "SystemAssigned, UserAssigned". - :paramtype type: str or ~azure.mgmt.appconfiguration.models.IdentityType - :keyword user_assigned_identities: The list of user-assigned identities associated with the - resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appconfiguration.models.UserIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.user_assigned_identities = user_assigned_identities - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - - -class ServiceSpecification(_serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: list[~azure.mgmt.appconfiguration.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: list[~azure.mgmt.appconfiguration.models.MetricSpecification] - """ - - _attribute_map = { - "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, - "metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"}, - } - - def __init__( - self, - *, - log_specifications: Optional[List["_models.LogSpecification"]] = None, - metric_specifications: Optional[List["_models.MetricSpecification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: list[~azure.mgmt.appconfiguration.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: list[~azure.mgmt.appconfiguration.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_serialization.Model): - """Describes a configuration store SKU. - - All required parameters must be populated in order to send to server. - - :ivar name: The SKU name of the configuration store. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: The SKU name of the configuration store. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class Snapshot(_serialization.Model): - """The snapshot resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the snapshot. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar provisioning_state: The provisioning state of the snapshot. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.appconfiguration.models.ProvisioningState - :ivar status: The current status of the snapshot. Known values are: "Provisioning", "Ready", - "Archived", and "Failed". - :vartype status: str or ~azure.mgmt.appconfiguration.models.SnapshotStatus - :ivar filters: A list of filters used to filter the key-values included in the snapshot. - :vartype filters: list[~azure.mgmt.appconfiguration.models.KeyValueFilter] - :ivar composition_type: The composition type describes how the key-values within the snapshot - are composed. The 'key' composition type ensures there are no two key-values containing the - same key. The 'key_label' composition type ensures there are no two key-values containing the - same key and label. Known values are: "Key" and "Key_Label". - :vartype composition_type: str or ~azure.mgmt.appconfiguration.models.CompositionType - :ivar created: The time that the snapshot was created. - :vartype created: ~datetime.datetime - :ivar expires: The time that the snapshot will expire. - :vartype expires: ~datetime.datetime - :ivar retention_period: The amount of time, in seconds, that a snapshot will remain in the - archived state before expiring. This property is only writable during the creation of a - snapshot. If not specified, the default lifetime of key-value revisions will be used. - :vartype retention_period: int - :ivar size: The size in bytes of the snapshot. - :vartype size: int - :ivar items_count: The amount of key-values in the snapshot. - :vartype items_count: int - :ivar tags: The tags of the snapshot. NOTE: These are data plane tags, not Azure Resource - Manager (ARM) tags. - :vartype tags: dict[str, str] - :ivar etag: A value representing the current state of the snapshot. - :vartype etag: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - "filters": {"max_items": 3, "min_items": 1}, - "created": {"readonly": True}, - "expires": {"readonly": True}, - "retention_period": {"maximum": 7776000, "minimum": 3600}, - "size": {"readonly": True}, - "items_count": {"readonly": True}, - "etag": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "filters": {"key": "properties.filters", "type": "[KeyValueFilter]"}, - "composition_type": {"key": "properties.compositionType", "type": "str"}, - "created": {"key": "properties.created", "type": "iso-8601"}, - "expires": {"key": "properties.expires", "type": "iso-8601"}, - "retention_period": {"key": "properties.retentionPeriod", "type": "int"}, - "size": {"key": "properties.size", "type": "int"}, - "items_count": {"key": "properties.itemsCount", "type": "int"}, - "tags": {"key": "properties.tags", "type": "{str}"}, - "etag": {"key": "properties.etag", "type": "str"}, - } - - def __init__( - self, - *, - filters: Optional[List["_models.KeyValueFilter"]] = None, - composition_type: Optional[Union[str, "_models.CompositionType"]] = None, - retention_period: Optional[int] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword filters: A list of filters used to filter the key-values included in the snapshot. - :paramtype filters: list[~azure.mgmt.appconfiguration.models.KeyValueFilter] - :keyword composition_type: The composition type describes how the key-values within the - snapshot are composed. The 'key' composition type ensures there are no two key-values - containing the same key. The 'key_label' composition type ensures there are no two key-values - containing the same key and label. Known values are: "Key" and "Key_Label". - :paramtype composition_type: str or ~azure.mgmt.appconfiguration.models.CompositionType - :keyword retention_period: The amount of time, in seconds, that a snapshot will remain in the - archived state before expiring. This property is only writable during the creation of a - snapshot. If not specified, the default lifetime of key-value revisions will be used. - :paramtype retention_period: int - :keyword tags: The tags of the snapshot. NOTE: These are data plane tags, not Azure Resource - Manager (ARM) tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.status: Optional[Union[str, "_models.SnapshotStatus"]] = None - self.filters = filters - self.composition_type = composition_type - self.created: Optional[datetime.datetime] = None - self.expires: Optional[datetime.datetime] = None - self.retention_period = retention_period - self.size: Optional[int] = None - self.items_count: Optional[int] = None - self.tags = tags - self.etag: Optional[str] = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.appconfiguration.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.appconfiguration.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.appconfiguration.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.appconfiguration.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class UserIdentity(_serialization.Model): - """A resource identity that is managed by the user of the service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the user-assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the user-assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/models/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/__init__.py index 38515cc7e967..c611b1e413fd 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/__init__.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,13 +12,13 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._configuration_stores_operations import ConfigurationStoresOperations # type: ignore +from ._operations import ConfigurationStoresOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import KeyValuesOperations # type: ignore +from ._operations import ReplicasOperations # type: ignore +from ._operations import SnapshotsOperations # type: ignore from ._operations import Operations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._key_values_operations import KeyValuesOperations # type: ignore -from ._replicas_operations import ReplicasOperations # type: ignore -from ._snapshots_operations import SnapshotsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -26,12 +26,12 @@ __all__ = [ "ConfigurationStoresOperations", - "Operations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", "KeyValuesOperations", "ReplicasOperations", "SnapshotsOperations", + "Operations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py deleted file mode 100644 index 309c27732939..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_configuration_stores_operations.py +++ /dev/null @@ -1,1613 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import AppConfigurationManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -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(subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, skip_token: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, config_store_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[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_create_request( - resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - 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.AppConfiguration/configurationStores/{configStoreName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[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 - 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, config_store_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - 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.AppConfiguration/configurationStores/{configStoreName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[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 - 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_list_keys_request( - resource_group_name: str, - config_store_name: str, - subscription_id: str, - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[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") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_key_request( - resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - 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.AppConfiguration/configurationStores/{configStoreName}/regenerateKey", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[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 - 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_deleted_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_deleted_request( - location: str, config_store_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[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_purge_deleted_request( - location: str, config_store_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConfigurationStoresOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s - :attr:`configuration_stores` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> ItemPaged["_models.ConfigurationStore"]: - """Lists the configuration stores for a given subscription. - - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ConfigurationStore or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :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.ConfigurationStoreListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ConfigurationStore"]: - """Lists the configuration stores for a given resource group. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ConfigurationStore or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :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.ConfigurationStoreListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore: - """Gets the properties of the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: ConfigurationStore or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.ConfigurationStore - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - config_store_name: str, - config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_store_creation_parameters, (IOBase, bytes)): - _content = config_store_creation_parameters - else: - _json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore") - - _request = build_create_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - config_store_name: str, - config_store_creation_parameters: _models.ConfigurationStore, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationStore]: - """Creates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_creation_parameters: The parameters for creating a configuration store. - Required. - :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.models.ConfigurationStore - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - config_store_name: str, - config_store_creation_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationStore]: - """Creates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_creation_parameters: The parameters for creating a configuration store. - Required. - :type config_store_creation_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - config_store_name: str, - config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ConfigurationStore]: - """Creates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_creation_parameters: The parameters for creating a configuration store. Is - either a ConfigurationStore type or a IO[bytes] type. Required. - :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.models.ConfigurationStore - or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :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.ConfigurationStore] = 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_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - config_store_creation_parameters=config_store_creation_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationStore].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationStore]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - config_store_name: str, - config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_store_update_parameters, (IOBase, bytes)): - _content = config_store_update_parameters - else: - _json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - config_store_name: str, - config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationStore]: - """Updates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_update_parameters: The parameters for updating a configuration store. - Required. - :type config_store_update_parameters: - ~azure.mgmt.appconfiguration.models.ConfigurationStoreUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - config_store_name: str, - config_store_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConfigurationStore]: - """Updates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_update_parameters: The parameters for updating a configuration store. - Required. - :type config_store_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - config_store_name: str, - config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ConfigurationStore]: - """Updates a configuration store with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param config_store_update_parameters: The parameters for updating a configuration store. Is - either a ConfigurationStoreUpdateParameters type or a IO[bytes] type. Required. - :type config_store_update_parameters: - ~azure.mgmt.appconfiguration.models.ConfigurationStoreUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either ConfigurationStore or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] - :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.ConfigurationStore] = 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, - config_store_name=config_store_name, - config_store_update_parameters=config_store_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConfigurationStore].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConfigurationStore]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_keys( - self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ApiKey"]: - """Lists the access key for the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either ApiKey or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.ApiKey] - :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.ApiKeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_keys_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApiKeyListResult", 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) - - @overload - def regenerate_key( - self, - resource_group_name: str, - config_store_name: str, - regenerate_key_parameters: _models.RegenerateKeyParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApiKey: - """Regenerates an access key for the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. Required. - :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.models.RegenerateKeyParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApiKey or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.ApiKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_key( - self, - resource_group_name: str, - config_store_name: str, - regenerate_key_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApiKey: - """Regenerates an access key for the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. Required. - :type regenerate_key_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApiKey or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.ApiKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_key( - self, - resource_group_name: str, - config_store_name: str, - regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ApiKey: - """Regenerates an access key for the specified configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param regenerate_key_parameters: The parameters for regenerating an access key. Is either a - RegenerateKeyParameters type or a IO[bytes] type. Required. - :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.models.RegenerateKeyParameters or - IO[bytes] - :return: ApiKey or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.ApiKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_key_parameters, (IOBase, bytes)): - _content = regenerate_key_parameters - else: - _json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters") - - _request = build_regenerate_key_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, 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("ApiKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_deleted(self, **kwargs: Any) -> ItemPaged["_models.DeletedConfigurationStore"]: - """Gets information about the deleted configuration stores in a subscription. - - :return: An iterator like instance of either DeletedConfigurationStore or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.DeletedConfigurationStore] - :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.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _models.DeletedConfigurationStore: - """Gets a deleted Azure app configuration store. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: DeletedConfigurationStore or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.DeletedConfigurationStore - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None) - - _request = build_get_deleted_request( - location=location, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _purge_deleted_initial(self, location: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_purge_deleted_request( - location=location, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]: - """Permanently deletes the specified configuration store. - - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._purge_deleted_initial( - location=location, - config_store_name=config_store_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_key_values_operations.py deleted file mode 100644 index 8fa9aefb9e2c..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_key_values_operations.py +++ /dev/null @@ -1,494 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import AppConfigurationManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -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, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "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, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - 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.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "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, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "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 KeyValuesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s - :attr:`key_values` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any - ) -> _models.KeyValue: - """Gets the properties of the specified key-value. NOTE: This operation is intended for use in ARM - Template deployments. For all other scenarios involving App Configuration key-values the data - plane API should be used instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :return: KeyValue or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.KeyValue - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - key_value_name=key_value_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("KeyValue", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - key_value_parameters: _models.KeyValue, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.KeyValue: - """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For - all other scenarios involving App Configuration key-values the data plane API should be used - instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :param key_value_parameters: The parameters for creating a key-value. Required. - :type key_value_parameters: ~azure.mgmt.appconfiguration.models.KeyValue - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: KeyValue or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.KeyValue - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - key_value_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.KeyValue: - """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For - all other scenarios involving App Configuration key-values the data plane API should be used - instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :param key_value_parameters: The parameters for creating a key-value. Required. - :type key_value_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: KeyValue or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.KeyValue - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - config_store_name: str, - key_value_name: str, - key_value_parameters: Union[_models.KeyValue, IO[bytes]], - **kwargs: Any - ) -> _models.KeyValue: - """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For - all other scenarios involving App Configuration key-values the data plane API should be used - instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type - or a IO[bytes] type. Required. - :type key_value_parameters: ~azure.mgmt.appconfiguration.models.KeyValue or IO[bytes] - :return: KeyValue or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.KeyValue - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(key_value_parameters, (IOBase, bytes)): - _content = key_value_parameters - else: - _json = self._serialize.body(key_value_parameters, "KeyValue") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - key_value_name=key_value_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, 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("KeyValue", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - key_value_name=key_value_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a key-value. NOTE: This operation is intended for use in ARM Template deployments. For - all other scenarios involving App Configuration key-values the data plane API should be used - instead. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param key_value_name: Identifier of key and label combination. Key and label are joined by $ - character. Label is optional. Required. - :type key_value_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - key_value_name=key_value_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_operations.py index 48545f62d795..bd7dceb4c12b 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_operations.py @@ -1,14 +1,15 @@ -# pylint: disable=line-too-long,useless-suppression +# pylint: disable=line-too-long,useless-suppression,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -18,107 +19,4400 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._configuration import AppConfigurationManagementClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +JSON = MutableMapping[str, Any] T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_configuration_stores_get_request( + resource_group_name: str, config_store_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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "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_configuration_stores_create_request( # pylint: disable=name-too-long + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "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_configuration_stores_update_request( # pylint: disable=name-too-long + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configuration_stores_delete_request( # pylint: disable=name-too-long + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_configuration_stores_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, *, skip_token: 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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configuration_stores_list_request( + subscription_id: str, *, skip_token: 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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configuration_stores_list_keys_request( # pylint: disable=name-too-long + resource_group_name: str, + config_store_name: str, + subscription_id: str, + *, + skip_token: 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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configuration_stores_regenerate_key_request( # pylint: disable=name-too-long + resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_configuration_stores_get_deleted_request( # pylint: disable=name-too-long + location: str, config_store_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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "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_configuration_stores_purge_deleted_request( # pylint: disable=name-too-long + location: str, config_store_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_configuration_stores_list_deleted_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability" - ) + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + # 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_private_endpoint_connections_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "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_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_private_endpoint_connections_list_by_configuration_store_request( # pylint: disable=name-too-long + resource_group_name: str, config_store_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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "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_private_link_resources_get_request( + resource_group_name: str, config_store_name: str, group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "groupName": _SERIALIZER.url("group_name", group_name, "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_private_link_resources_list_by_configuration_store_request( # pylint: disable=name-too-long + resource_group_name: str, config_store_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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "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_key_values_get_request( + resource_group_name: str, config_store_name: str, key_value_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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "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_key_values_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "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_key_values_delete_request( + resource_group_name: str, config_store_name: str, key_value_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_replicas_get_request( + resource_group_name: str, config_store_name: str, replica_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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "replicaName": _SERIALIZER.url("replica_name", replica_name, "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_replicas_create_request( + resource_group_name: str, config_store_name: str, replica_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "replicaName": _SERIALIZER.url("replica_name", replica_name, "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_replicas_delete_request( + resource_group_name: str, config_store_name: str, replica_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "replicaName": _SERIALIZER.url("replica_name", replica_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_replicas_list_by_configuration_store_request( # pylint: disable=name-too-long + resource_group_name: str, + config_store_name: str, + subscription_id: str, + *, + skip_token: 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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_snapshots_get_request( + resource_group_name: str, config_store_name: str, snapshot_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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/snapshots/{snapshotName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "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_snapshots_create_request( + resource_group_name: str, config_store_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/snapshots/{snapshotName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "configStoreName": _SERIALIZER.url("config_store_name", config_store_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "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_operations_list_request(*, skip_token: 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", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.AppConfiguration/operations" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_operations_check_name_availability_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + 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_operations_regional_check_name_availability_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ConfigurationStoresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s + :attr:`configuration_stores` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore: + """Gets the properties of the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: ConfigurationStore. The ConfigurationStore is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ConfigurationStore + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None) + + _request = build_configuration_stores_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConfigurationStore, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: Union[_models.ConfigurationStore, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(config_store_creation_parameters, (IOBase, bytes)): + _content = config_store_creation_parameters + else: + _content = json.dumps(config_store_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_configuration_stores_create_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: _models.ConfigurationStore, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.models.ConfigurationStore + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConfigurationStore. The ConfigurationStore is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConfigurationStore. The ConfigurationStore is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. + Required. + :type config_store_creation_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConfigurationStore. The ConfigurationStore is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + config_store_creation_parameters: Union[_models.ConfigurationStore, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Creates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_creation_parameters: The parameters for creating a configuration store. Is + one of the following types: ConfigurationStore, JSON, IO[bytes] Required. + :type config_store_creation_parameters: ~azure.mgmt.appconfiguration.models.ConfigurationStore + or JSON or IO[bytes] + :return: An instance of LROPoller that returns ConfigurationStore. The ConfigurationStore is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = 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_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + config_store_creation_parameters=config_store_creation_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ConfigurationStore, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConfigurationStore].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConfigurationStore]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(config_store_update_parameters, (IOBase, bytes)): + _content = config_store_update_parameters + else: + _content = json.dumps(config_store_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_configuration_stores_update_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: _models.ConfigurationStoreUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: + ~azure.mgmt.appconfiguration.models.ConfigurationStoreUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConfigurationStore. The ConfigurationStore is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConfigurationStore. The ConfigurationStore is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. + Required. + :type config_store_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConfigurationStore. The ConfigurationStore is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + config_store_name: str, + config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ConfigurationStore]: + """Updates a configuration store with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param config_store_update_parameters: The parameters for updating a configuration store. Is + one of the following types: ConfigurationStoreUpdateParameters, JSON, IO[bytes] Required. + :type config_store_update_parameters: + ~azure.mgmt.appconfiguration.models.ConfigurationStoreUpdateParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns ConfigurationStore. The ConfigurationStore is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConfigurationStore] = 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, + config_store_name=config_store_name, + config_store_update_parameters=config_store_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ConfigurationStore, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConfigurationStore].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConfigurationStore]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_configuration_stores_delete_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.ConfigurationStore"]: + """Lists the configuration stores for a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ConfigurationStore + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConfigurationStore]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_configuration_stores_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ConfigurationStore], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, *, skip_token: Optional[str] = None, **kwargs: Any) -> ItemPaged["_models.ConfigurationStore"]: + """Lists the configuration stores for a given subscription. + + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ConfigurationStore + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.ConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConfigurationStore]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_configuration_stores_list_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ConfigurationStore], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_keys( + self, resource_group_name: str, config_store_name: str, *, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.ApiKey"]: + """Lists the access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of ApiKey + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.ApiKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ApiKey]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_configuration_stores_list_keys_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ApiKey], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: _models.RegenerateKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.models.RegenerateKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApiKey. The ApiKey is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApiKey. The ApiKey is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Required. + :type regenerate_key_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApiKey. The ApiKey is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_key( + self, + resource_group_name: str, + config_store_name: str, + regenerate_key_parameters: Union[_models.RegenerateKeyParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApiKey: + """Regenerates an access key for the specified configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param regenerate_key_parameters: The parameters for regenerating an access key. Is one of the + following types: RegenerateKeyParameters, JSON, IO[bytes] Required. + :type regenerate_key_parameters: ~azure.mgmt.appconfiguration.models.RegenerateKeyParameters or + JSON or IO[bytes] + :return: ApiKey. The ApiKey is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.ApiKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(regenerate_key_parameters, (IOBase, bytes)): + _content = regenerate_key_parameters + else: + _content = json.dumps(regenerate_key_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_configuration_stores_regenerate_key_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApiKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _models.DeletedConfigurationStore: + """Gets a deleted Azure app configuration store. + + :param location: The name of the Azure region. Required. + :type location: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: DeletedConfigurationStore. The DeletedConfigurationStore is compatible with + MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.DeletedConfigurationStore + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None) + + _request = build_configuration_stores_get_deleted_request( + location=location, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeletedConfigurationStore, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _purge_deleted_initial(self, location: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_configuration_stores_purge_deleted_request( + location=location, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]: + """Permanently deletes the specified configuration store. + + :param location: The name of the Azure region. Required. + :type location: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._purge_deleted_initial( + location=location, + config_store_name=config_store_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_deleted(self, **kwargs: Any) -> ItemPaged["_models.DeletedConfigurationStore"]: + """Gets information about the deleted configuration stores in a subscription. + + :return: An iterator like instance of DeletedConfigurationStore + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.DeletedConfigurationStore] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedConfigurationStore]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_configuration_stores_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeletedConfigurationStore], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection associated with the configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection + else: + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_or_update_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: + ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Required. + :type private_endpoint_connection: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + config_store_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of the specified private endpoint connection associated with the configuration + store. This operation cannot be used to create a private endpoint connection. Private endpoint + connections must be created with the Network resource provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection properties. Is one of the + following types: PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: + ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = 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, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param private_endpoint_connection_name: Private endpoint connection name. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_configuration_store( + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """Lists all private endpoint connections for a configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_private_endpoint_connections_list_by_configuration_store_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets a private link resource that need to be created for a configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param group_name: The name of the private link resource group. Required. + :type group_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_private_link_resources_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_configuration_store( + self, resource_group_name: str, config_store_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateLinkResource"]: + """Gets the private link resources that need to be created for a configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_private_link_resources_list_by_configuration_store_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class KeyValuesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s + :attr:`key_values` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any + ) -> _models.KeyValue: + """Gets the properties of the specified key-value. NOTE: This operation is intended for use in ARM + Template deployments. For all other scenarios involving App Configuration key-values the data + plane API should be used instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + + _request = build_key_values_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + key_value_name=key_value_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.KeyValue, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: _models.KeyValue, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Required. + :type key_value_parameters: ~azure.mgmt.appconfiguration.models.KeyValue + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Required. + :type key_value_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Required. + :type key_value_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + config_store_name: str, + key_value_name: str, + key_value_parameters: Union[_models.KeyValue, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.KeyValue: + """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :param key_value_parameters: The parameters for creating a key-value. Is one of the following + types: KeyValue, JSON, IO[bytes] Required. + :type key_value_parameters: ~azure.mgmt.appconfiguration.models.KeyValue or JSON or IO[bytes] + :return: KeyValue. The KeyValue is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.KeyValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(key_value_parameters, (IOBase, bytes)): + _content = key_value_parameters + else: + _content = json.dumps(key_value_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_key_values_create_or_update_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + key_value_name=key_value_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.KeyValue, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_key_values_delete_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + key_value_name=key_value_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a key-value. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration key-values the data plane API should be used + instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param key_value_name: Identifier of key and label combination. Key and label are joined by $ + character. Label is optional. Required. + :type key_value_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + key_value_name=key_value_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ReplicasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s + :attr:`replicas` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any + ) -> _models.Replica: + """Gets the properties of the specified replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :return: Replica. The Replica is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.Replica + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Replica] = kwargs.pop("cls", None) + + _request = build_replicas_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Replica, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: Union[_models.Replica, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(replica_creation_parameters, (IOBase, bytes)): + _content = replica_creation_parameters + else: + _content = json.dumps(replica_creation_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replicas_create_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: _models.Replica, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Required. + :type replica_creation_parameters: ~azure.mgmt.appconfiguration.models.Replica + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Replica. The Replica is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Required. + :type replica_creation_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Replica. The Replica is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Required. + :type replica_creation_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Replica. The Replica is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + replica_name: str, + replica_creation_parameters: Union[_models.Replica, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Creates a replica with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param replica_creation_parameters: The parameters for creating a replica. Is one of the + following types: Replica, JSON, IO[bytes] Required. + :type replica_creation_parameters: ~azure.mgmt.appconfiguration.models.Replica or JSON or + IO[bytes] + :return: An instance of LROPoller that returns Replica. The Replica is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replica] = 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_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + replica_creation_parameters=replica_creation_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Replica, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Replica].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Replica]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_replicas_delete_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + replica_name=replica_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_configuration_store( + self, resource_group_name: str, config_store_name: str, *, skip_token: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Replica"]: + """Lists the replicas for a given configuration store. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of Replica + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Replica]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_replicas_list_by_configuration_store_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + subscription_id=self._config.subscription_id, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Replica], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s + :attr:`snapshots` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AppConfigurationManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, config_store_name: str, snapshot_name: str, **kwargs: Any + ) -> _models.Snapshot: + """Gets the properties of the specified snapshot. NOTE: This operation is intended for use in ARM + Template deployments. For all other scenarios involving App Configuration snapshots the data + plane API should be used instead. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :return: Snapshot. The Snapshot is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.Snapshot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + + _request = build_snapshots_get_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Snapshot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_snapshots_create_request( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + snapshot_name=snapshot_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response - # 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") + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.iter_bytes() -def build_list_request(*, skip_token: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") + return deserialized # type: ignore - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppConfiguration/operations") + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: _models.Snapshot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Creates a snapshot. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration snapshots the data plane API should be used + instead. - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :param body: The parameters for creating a snapshot. Required. + :type body: ~azure.mgmt.appconfiguration.models.Snapshot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Creates a snapshot. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration snapshots the data plane API should be used + instead. - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :param body: The parameters for creating a snapshot. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Creates a snapshot. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration snapshots the data plane API should be used + instead. -def build_regional_check_name_availability_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :param body: The parameters for creating a snapshot. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") + @distributed_trace + def begin_create( + self, + resource_group_name: str, + config_store_name: str, + snapshot_name: str, + body: Union[_models.Snapshot, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Creates a snapshot. NOTE: This operation is intended for use in ARM Template deployments. For + all other scenarios involving App Configuration snapshots the data plane API should be used + instead. - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param config_store_name: The name of the configuration store. Required. + :type config_store_name: str + :param snapshot_name: The name of the snapshot. Required. + :type snapshot_name: str + :param body: The parameters for creating a snapshot. Is one of the following types: Snapshot, + JSON, IO[bytes] Required. + :type body: ~azure.mgmt.appconfiguration.models.Snapshot or JSON or IO[bytes] + :return: An instance of LROPoller that returns Snapshot. The Snapshot is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _url: str = _url.format(**path_format_arguments) # type: ignore + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = 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_initial( + resource_group_name=resource_group_name, + config_store_name=config_store_name, + snapshot_name=snapshot_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Snapshot, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - # 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") + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Snapshot].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) class Operations: @@ -131,8 +4425,6 @@ class Operations: :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") @@ -142,6 +4434,98 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list(self, *, skip_token: Optional[str] = None, **kwargs: Any) -> ItemPaged["_models.OperationDefinition"]: + """List the operations for the provider. + + :keyword skip_token: A skip token is used to continue retrieving items after an operation + returns a partial result. If a previous response contains a nextLink element, the value of the + nextLink element will include a skipToken parameter that specifies a starting point to use for + subsequent calls. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of OperationDefinition + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.OperationDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationDefinition]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_operations_list_request( + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationDefinition], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + @overload def check_name_availability( self, @@ -152,14 +4536,29 @@ def check_name_availability( ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param check_name_availability_parameters: The object containing information for the - availability request. Required. + :param check_name_availability_parameters: The request body. Required. :type check_name_availability_parameters: ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: NameAvailabilityStatus or the result of cls(response) + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, check_name_availability_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. + + :param check_name_availability_parameters: The request body. Required. + :type check_name_availability_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ @@ -170,13 +4569,12 @@ def check_name_availability( ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param check_name_availability_parameters: The object containing information for the - availability request. Required. + :param check_name_availability_parameters: The request body. Required. :type check_name_availability_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: NameAvailabilityStatus or the result of cls(response) + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ @@ -184,17 +4582,16 @@ def check_name_availability( @distributed_trace def check_name_availability( self, - check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], + check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, JSON, IO[bytes]], **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param check_name_availability_parameters: The object containing information for the - availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type. - Required. + :param check_name_availability_parameters: The request body. Is one of the following types: + CheckNameAvailabilityParameters, JSON, IO[bytes] Required. :type check_name_availability_parameters: - ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters or IO[bytes] - :return: NameAvailabilityStatus or the result of cls(response) + ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters or JSON or IO[bytes] + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ @@ -207,32 +4604,32 @@ def check_name_availability( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) content_type = content_type or "application/json" - _json = None _content = None if isinstance(check_name_availability_parameters, (IOBase, bytes)): _content = check_name_availability_parameters else: - _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") + _content = json.dumps(check_name_availability_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_check_name_availability_request( + _request = build_operations_check_name_availability_request( subscription_id=self._config.subscription_id, - api_version=api_version, content_type=content_type, - json=_json, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -240,118 +4637,71 @@ def check_name_availability( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NameAvailabilityStatus, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> ItemPaged["_models.OperationDefinition"]: - """Lists the operations available from this provider. + @overload + def regional_check_name_availability( + self, + location: str, + check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityStatus: + """Checks whether the configuration store name is available for use. - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either OperationDefinition or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.OperationDefinition] + :param location: The location name. Required. + :type location: str + :param check_name_availability_parameters: The request body. Required. + :type check_name_availability_parameters: + ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :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.OperationDefinitionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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( - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OperationDefinitionListResult", 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) @overload def regional_check_name_availability( self, location: str, - check_name_availability_parameters: _models.CheckNameAvailabilityParameters, + check_name_availability_parameters: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. Required. + :param location: The location name. Required. :type location: str - :param check_name_availability_parameters: The object containing information for the - availability request. Required. - :type check_name_availability_parameters: - ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters + :param check_name_availability_parameters: The request body. Required. + :type check_name_availability_parameters: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: NameAvailabilityStatus or the result of cls(response) + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ @@ -367,15 +4717,14 @@ def regional_check_name_availability( ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. Required. + :param location: The location name. Required. :type location: str - :param check_name_availability_parameters: The object containing information for the - availability request. Required. + :param check_name_availability_parameters: The request body. Required. :type check_name_availability_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: NameAvailabilityStatus or the result of cls(response) + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ @@ -384,19 +4733,18 @@ def regional_check_name_availability( def regional_check_name_availability( self, location: str, - check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], + check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, JSON, IO[bytes]], **kwargs: Any ) -> _models.NameAvailabilityStatus: """Checks whether the configuration store name is available for use. - :param location: The location in which uniqueness will be verified. Required. + :param location: The location name. Required. :type location: str - :param check_name_availability_parameters: The object containing information for the - availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type. - Required. + :param check_name_availability_parameters: The request body. Is one of the following types: + CheckNameAvailabilityParameters, JSON, IO[bytes] Required. :type check_name_availability_parameters: - ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters or IO[bytes] - :return: NameAvailabilityStatus or the result of cls(response) + ~azure.mgmt.appconfiguration.models.CheckNameAvailabilityParameters or JSON or IO[bytes] + :return: NameAvailabilityStatus. The NameAvailabilityStatus is compatible with MutableMapping :rtype: ~azure.mgmt.appconfiguration.models.NameAvailabilityStatus :raises ~azure.core.exceptions.HttpResponseError: """ @@ -409,33 +4757,33 @@ def regional_check_name_availability( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None) content_type = content_type or "application/json" - _json = None _content = None if isinstance(check_name_availability_parameters, (IOBase, bytes)): _content = check_name_availability_parameters else: - _json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters") + _content = json.dumps(check_name_availability_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_regional_check_name_availability_request( + _request = build_operations_regional_check_name_availability_request( location=location, subscription_id=self._config.subscription_id, - api_version=api_version, content_type=content_type, - json=_json, + api_version=self._config.api_version, content=_content, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -443,11 +4791,22 @@ def regional_check_name_availability( response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NameAvailabilityStatus, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_patch.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_patch.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 5ea5391bfb25..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,693 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import AppConfigurationManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -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_configuration_store_request( # pylint: disable=name-too-long - resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "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, - config_store_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - 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.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "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, - config_store_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "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 PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_configuration_store( - self, resource_group_name: str, config_store_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateEndpointConnection"]: - """Lists all private endpoint connections for a configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :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.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_configuration_store_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets the specified private endpoint connection associated with the configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection - else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Update the state of the specified private endpoint connection associated with the configuration - store. This operation cannot be used to create a private endpoint connection. Private endpoint - connections must be created with the Network resource provider. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. Required. - :type private_endpoint_connection: - ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Update the state of the specified private endpoint connection associated with the configuration - store. This operation cannot be used to create a private endpoint connection. Private endpoint - connections must be created with the Network resource provider. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. Required. - :type private_endpoint_connection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - config_store_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Update the state of the specified private endpoint connection associated with the configuration - store. This operation cannot be used to create a private endpoint connection. Private endpoint - connections must be created with the Network resource provider. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The private endpoint connection properties. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type private_endpoint_connection: - ~azure.mgmt.appconfiguration.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.PrivateEndpointConnection] - :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.PrivateEndpointConnection] = 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, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a private endpoint connection. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_link_resources_operations.py deleted file mode 100644 index 051c922abd06..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,271 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import AppConfigurationManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -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_configuration_store_request( # pylint: disable=name-too-long - resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, config_store_name: str, group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "groupName": _SERIALIZER.url("group_name", group_name, "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 PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_configuration_store( - self, resource_group_name: str, config_store_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.PrivateLinkResource] - :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.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_configuration_store_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Gets a private link resource that need to be created for a configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param group_name: The name of the private link resource group. Required. - :type group_name: str - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.PrivateLinkResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_replicas_operations.py deleted file mode 100644 index 7a3ab0494461..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_replicas_operations.py +++ /dev/null @@ -1,682 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import AppConfigurationManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -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_configuration_store_request( # pylint: disable=name-too-long - resource_group_name: str, - config_store_name: str, - subscription_id: str, - *, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[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") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, config_store_name: str, replica_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "replicaName": _SERIALIZER.url("replica_name", replica_name, "str", pattern=r"^[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_create_request( - resource_group_name: str, config_store_name: str, replica_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - 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.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "replicaName": _SERIALIZER.url("replica_name", replica_name, "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, config_store_name: str, replica_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "replicaName": _SERIALIZER.url("replica_name", replica_name, "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 ReplicasOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s - :attr:`replicas` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_configuration_store( - self, resource_group_name: str, config_store_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Replica"]: - """Lists the replicas for a given configuration store. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param skip_token: A skip token is used to continue retrieving items after an operation returns - a partial result. If a previous response contains a nextLink element, the value of the nextLink - element will include a skipToken parameter that specifies a starting point to use for - subsequent calls. Default value is None. - :type skip_token: str - :return: An iterator like instance of either Replica or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.models.Replica] - :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.ReplicaListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 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_configuration_store_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - subscription_id=self._config.subscription_id, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ReplicaListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any - ) -> _models.Replica: - """Gets the properties of the specified replica. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :return: Replica or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.Replica - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Replica] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Replica", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - replica_creation_parameters: Union[_models.Replica, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(replica_creation_parameters, (IOBase, bytes)): - _content = replica_creation_parameters - else: - _json = self._serialize.body(replica_creation_parameters, "Replica") - - _request = build_create_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - replica_creation_parameters: _models.Replica, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Replica]: - """Creates a replica with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :param replica_creation_parameters: The parameters for creating a replica. Required. - :type replica_creation_parameters: ~azure.mgmt.appconfiguration.models.Replica - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Replica or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Replica] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - replica_creation_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Replica]: - """Creates a replica with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :param replica_creation_parameters: The parameters for creating a replica. Required. - :type replica_creation_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Replica or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Replica] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - config_store_name: str, - replica_name: str, - replica_creation_parameters: Union[_models.Replica, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Replica]: - """Creates a replica with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :param replica_creation_parameters: The parameters for creating a replica. Is either a Replica - type or a IO[bytes] type. Required. - :type replica_creation_parameters: ~azure.mgmt.appconfiguration.models.Replica or IO[bytes] - :return: An instance of LROPoller that returns either Replica or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Replica] - :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.Replica] = 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_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - replica_creation_parameters=replica_creation_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Replica", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Replica].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Replica]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a replica. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param replica_name: The name of the replica. Required. - :type replica_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - replica_name=replica_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_snapshots_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_snapshots_operations.py deleted file mode 100644 index 3fefc6963984..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/operations/_snapshots_operations.py +++ /dev/null @@ -1,410 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import AppConfigurationManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -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, config_store_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/snapshots/{snapshotName}", - ) - 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 - ), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str", pattern=r"^[^\x00-\x1F\x7F]+$"), - } - - _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_request( - resource_group_name: str, config_store_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) - 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.AppConfiguration/configurationStores/{configStoreName}/snapshots/{snapshotName}", - ) - 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 - ), - "configStoreName": _SERIALIZER.url( - "config_store_name", config_store_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9_-]*$" - ), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str", pattern=r"^[^\x00-\x1F\x7F]+$"), - } - - _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) - - -class SnapshotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.appconfiguration.AppConfigurationManagementClient`'s - :attr:`snapshots` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AppConfigurationManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, config_store_name: str, snapshot_name: str, **kwargs: Any - ) -> _models.Snapshot: - """Gets the properties of the specified snapshot. NOTE: This operation is intended for use in - Azure Resource Manager (ARM) Template deployments. For all other scenarios involving App - Configuration snapshots the data plane API should be used instead. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param snapshot_name: The name of the snapshot. Required. - :type snapshot_name: str - :return: Snapshot or the result of cls(response) - :rtype: ~azure.mgmt.appconfiguration.models.Snapshot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - config_store_name: str, - snapshot_name: str, - body: Union[_models.Snapshot, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "Snapshot") - - _request = build_create_request( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - config_store_name: str, - snapshot_name: str, - body: _models.Snapshot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Creates a snapshot. NOTE: This operation is intended for use in Azure Resource Manager (ARM) - Template deployments. For all other scenarios involving App Configuration snapshots the data - plane API should be used instead. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param snapshot_name: The name of the snapshot. Required. - :type snapshot_name: str - :param body: The parameters for creating a snapshot. Required. - :type body: ~azure.mgmt.appconfiguration.models.Snapshot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - config_store_name: str, - snapshot_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Creates a snapshot. NOTE: This operation is intended for use in Azure Resource Manager (ARM) - Template deployments. For all other scenarios involving App Configuration snapshots the data - plane API should be used instead. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param snapshot_name: The name of the snapshot. Required. - :type snapshot_name: str - :param body: The parameters for creating a snapshot. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - config_store_name: str, - snapshot_name: str, - body: Union[_models.Snapshot, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Creates a snapshot. NOTE: This operation is intended for use in Azure Resource Manager (ARM) - Template deployments. For all other scenarios involving App Configuration snapshots the data - plane API should be used instead. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param config_store_name: The name of the configuration store. Required. - :type config_store_name: str - :param snapshot_name: The name of the snapshot. Required. - :type snapshot_name: str - :param body: The parameters for creating a snapshot. Is either a Snapshot type or a IO[bytes] - type. Required. - :type body: ~azure.mgmt.appconfiguration.models.Snapshot or IO[bytes] - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.models.Snapshot] - :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.Snapshot] = 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_initial( - resource_group_name=resource_group_name, - config_store_name=config_store_name, - snapshot_name=snapshot_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Snapshot].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Snapshot]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py index 14b503e944b4..ca64cf2dd468 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.operations.check_name_availability( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/CheckNameAvailable.json +# x-ms-original-file: 2025-06-01-preview/CheckNameAvailable.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py index bf3035decefc..eedc73dc7019 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.operations.check_name_availability( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/CheckNameNotAvailable.json +# x-ms-original-file: 2025-06-01-preview/CheckNameNotAvailable.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py index 371198c16ec6..12aa57745ccf 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.begin_create( @@ -43,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresCreate.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresCreate.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py index 3c9ba1ea1db6..932df9c85dee 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.key_values.create_or_update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresCreateKeyValue.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresCreateKeyValue.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_replica.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_replica.py index 9a1f445bb32e..e1ef87e667ac 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_replica.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_replica.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.replicas.begin_create( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresCreateReplica.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresCreateReplica.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_snapshot.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_snapshot.py index 07e066941b8e..4119a7715589 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_snapshot.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_snapshot.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.snapshots.begin_create( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresCreateSnapshot.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresCreateSnapshot.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_azure_front_door.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_azure_front_door.py new file mode 100644 index 000000000000..2e4881f24c50 --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_azure_front_door.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_create_with_azure_front_door.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.configuration_stores.begin_create( + resource_group_name="myResourceGroup", + config_store_name="contoso", + config_store_creation_parameters={ + "location": "westus", + "properties": { + "azureFrontDoor": { + "resourceId": "/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/microsoft.cdn/profiles/myAzureFrontDoorProfile" + } + }, + "sku": {"name": "Standard"}, + "tags": {"myTag": "myTagValue"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresCreateWithAzureFrontDoor.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_data_plane_proxy.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_data_plane_proxy.py index fc78a4ac655d..943c9e4a7917 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_data_plane_proxy.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_data_plane_proxy.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.begin_create( @@ -45,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresCreateWithDataPlaneProxy.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresCreateWithDataPlaneProxy.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py index 9f64b89ca24a..c5659c35ec3f 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.begin_create( @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresCreateWithIdentity.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresCreateWithIdentity.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py index 6bd539fd71c6..31ebe12449aa 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.begin_create( @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresCreateWithLocalAuthDisabled.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresCreateWithLocalAuthDisabled.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_telemetry.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_telemetry.py new file mode 100644 index 000000000000..f37f8ad76b7f --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_telemetry.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appconfiguration import AppConfigurationManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appconfiguration +# USAGE + python configuration_stores_create_with_telemetry.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AppConfigurationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.configuration_stores.begin_create( + resource_group_name="myResourceGroup", + config_store_name="contoso", + config_store_creation_parameters={ + "location": "westus", + "properties": { + "telemetry": { + "resourceId": "/subscriptions/c80fb759-c965-4c6a-9110-9b2b2d038882/resourceGroups/myResourceGroup/providers/microsoft.insights/components/appInsightsName" + } + }, + "sku": {"name": "Standard"}, + "tags": {"myTag": "myTagValue"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresCreateWithTelemetry.json +if __name__ == "__main__": + main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py index b4d3a966ba61..e70206ad224b 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) client.configuration_stores.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresDelete.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresDelete.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py index 72915d5b1f3c..77b6e15b10d5 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) client.key_values.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresDeleteKeyValue.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresDeleteKeyValue.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py index 1d58ea090a85..6499e9ceaa16 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) client.private_endpoint_connections.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresDeletePrivateEndpointConnection.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresDeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_replica.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_replica.py index c1ff5fbb31c1..e2f2ad805acd 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_replica.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_replica.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) client.replicas.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresDeleteReplica.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresDeleteReplica.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py index aa8b9c4a0bc9..f365273f9840 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresGet.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresGet.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py index 3ef012e455b0..eb55936ebcc6 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.key_values.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresGetKeyValue.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresGetKeyValue.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py index 9dee1ed40510..ea6e416c173d 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresGetPrivateEndpointConnection.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresGetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_replica.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_replica.py index bcb6e2f912b6..7abde7e65c4a 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_replica.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_replica.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.replicas.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresGetReplica.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresGetReplica.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_snapshot.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_snapshot.py index d7d6f96f77e4..c3a206106a96 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_snapshot.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_snapshot.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.snapshots.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresGetSnapshot.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresGetSnapshot.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py index f36213a9d82b..ae8dd2c824ab 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.list() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresList.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresList.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py index eec4a058fae8..65c27c4a230e 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresListByResourceGroup.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py index 8dc86149357b..477d4aaac680 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.list_keys( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresListKeys.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresListKeys.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py index 319dffbc8ad2..952548c91438 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.list_by_configuration_store( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresListPrivateEndpointConnections.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_replicas.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_replicas.py index 303dd0799959..149aa189def9 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_replicas.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_replicas.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.replicas.list_by_configuration_store( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresListReplicas.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresListReplicas.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py index 948543e49142..8ed20ae480b0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.regenerate_key( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresRegenerateKey.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresRegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py index a72d3b56c6c6..7580a8ce18ba 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresUpdate.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py index b274baa3ba4b..5acdae2f4a25 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresUpdateDisableLocalAuth.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresUpdateDisableLocalAuth.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py index 87b6dd62b3db..faf1bd068c4f 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.begin_create_or_update( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresUpdatePrivateEndpointConnection.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresUpdatePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py index 7450b7981855..5b60c8a19058 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.begin_update( @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/ConfigurationStoresUpdateWithIdentity.json +# x-ms-original-file: 2025-06-01-preview/ConfigurationStoresUpdateWithIdentity.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py index a211bde3c7cb..59d36b9baa9e 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.get_deleted( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/DeletedConfigurationStoresGet.json +# x-ms-original-file: 2025-06-01-preview/DeletedConfigurationStoresGet.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py index f63c66e7a6fd..7e8a08a20b73 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.configuration_stores.list_deleted() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/DeletedConfigurationStoresList.json +# x-ms-original-file: 2025-06-01-preview/DeletedConfigurationStoresList.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py index 0346105abd15..d780b643eaaa 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) client.configuration_stores.begin_purge_deleted( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/DeletedConfigurationStoresPurge.json +# x-ms-original-file: 2025-06-01-preview/DeletedConfigurationStoresPurge.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py index c26dfa3245f8..8d4bf6737c40 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/OperationsList.json +# x-ms-original-file: 2025-06-01-preview/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py index fd9f42e1cef8..2f2a82131fcd 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_resources.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/PrivateLinkResourceGet.json +# x-ms-original-file: 2025-06-01-preview/PrivateLinkResourceGet.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py index 0bf0bc855ca8..423ca8afc6a0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_resources.list_by_configuration_store( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/PrivateLinkResourcesListByConfigurationStore.json +# x-ms-original-file: 2025-06-01-preview/PrivateLinkResourcesListByConfigurationStore.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py index 226273fc0689..907a458f9a72 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.operations.regional_check_name_availability( @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/RegionalCheckNameAvailable.json +# x-ms-original-file: 2025-06-01-preview/RegionalCheckNameAvailable.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py index 5d6c9efe6d21..6399645ca228 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = AppConfigurationManagementClient( credential=DefaultAzureCredential(), - subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882", + subscription_id="SUBSCRIPTION_ID", ) response = client.operations.regional_check_name_availability( @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2024-06-01/examples/RegionalCheckNameNotAvailable.json +# x-ms-original-file: 2025-06-01-preview/RegionalCheckNameNotAvailable.json if __name__ == "__main__": main() diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/conftest.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/conftest.py index 27757dc65fed..aca1fa0b130d 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/conftest.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations.py index 05c321d3a7f5..d40cc21caf4f 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,34 +18,12 @@ class TestAppConfigurationManagementConfigurationStoresOperations(AzureMgmtRecor def setup_method(self, method): self.client = self.create_mgmt_client(AppConfigurationManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_configuration_stores_list(self, resource_group): - response = self.client.configuration_stores.list( - api_version="2024-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_configuration_stores_list_by_resource_group(self, resource_group): - response = self.client.configuration_stores.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_configuration_stores_get(self, resource_group): response = self.client.configuration_stores.get( resource_group_name=resource_group.name, config_store_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -60,14 +38,6 @@ def test_configuration_stores_begin_create(self, resource_group): config_store_creation_parameters={ "location": "str", "sku": {"name": "str"}, - "createMode": "str", - "creationDate": "2020-02-20 00:00:00", - "dataPlaneProxy": {"authenticationMode": "str", "privateLinkDelegation": "str"}, - "defaultKeyValueRevisionRetentionPeriodInSeconds": 0, - "disableLocalAuth": False, - "enablePurgeProtection": False, - "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}}, - "endpoint": "str", "id": "str", "identity": { "principalId": "str", @@ -76,23 +46,38 @@ def test_configuration_stores_begin_create(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "name": "str", - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", - }, - "provisioningState": "str", - "type": "str", - } - ], - "provisioningState": "str", - "publicNetworkAccess": "str", - "softDeleteRetentionInDays": 7, + "properties": { + "azureFrontDoor": {"resourceId": "str"}, + "createMode": "str", + "creationDate": "2020-02-20 00:00:00", + "dataPlaneProxy": {"authenticationMode": "str", "privateLinkDelegation": "str"}, + "defaultKeyValueRevisionRetentionPeriodInSeconds": 0, + "disableLocalAuth": bool, + "enablePurgeProtection": bool, + "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}}, + "endpoint": "str", + "managedOnBehalfOfConfiguration": {"moboBrokerResources": [{"id": "str"}]}, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "softDeleteRetentionInDays": 0, + "telemetry": {"resourceId": "str"}, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -104,19 +89,6 @@ def test_configuration_stores_begin_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-06-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_configuration_stores_begin_delete(self, resource_group): - response = self.client.configuration_stores.begin_delete( - resource_group_name=resource_group.name, - config_store_name="str", - api_version="2024-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -129,22 +101,25 @@ def test_configuration_stores_begin_update(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", config_store_update_parameters={ - "dataPlaneProxy": {"authenticationMode": "str", "privateLinkDelegation": "str"}, - "defaultKeyValueRevisionRetentionPeriodInSeconds": 0, - "disableLocalAuth": bool, - "enablePurgeProtection": bool, - "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}}, "identity": { "principalId": "str", "tenantId": "str", "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "publicNetworkAccess": "str", + "properties": { + "azureFrontDoor": {"resourceId": "str"}, + "dataPlaneProxy": {"authenticationMode": "str", "privateLinkDelegation": "str"}, + "defaultKeyValueRevisionRetentionPeriodInSeconds": 0, + "disableLocalAuth": bool, + "enablePurgeProtection": bool, + "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}}, + "publicNetworkAccess": "str", + "telemetry": {"resourceId": "str"}, + }, "sku": {"name": "str"}, "tags": {"str": "str"}, }, - api_version="2024-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -152,11 +127,20 @@ def test_configuration_stores_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_configuration_stores_list_keys(self, resource_group): - response = self.client.configuration_stores.list_keys( + def test_configuration_stores_begin_delete(self, resource_group): + response = self.client.configuration_stores.begin_delete( resource_group_name=resource_group.name, config_store_name="str", - api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_configuration_stores_list_by_resource_group(self, resource_group): + response = self.client.configuration_stores.list_by_resource_group( + resource_group_name=resource_group.name, ) result = [r for r in response] # please add some check logic here by yourself @@ -164,24 +148,32 @@ def test_configuration_stores_list_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_configuration_stores_regenerate_key(self, resource_group): - response = self.client.configuration_stores.regenerate_key( + def test_configuration_stores_list(self, resource_group): + response = self.client.configuration_stores.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_configuration_stores_list_keys(self, resource_group): + response = self.client.configuration_stores.list_keys( resource_group_name=resource_group.name, config_store_name="str", - regenerate_key_parameters={"id": "str"}, - api_version="2024-06-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_configuration_stores_list_deleted(self, resource_group): - response = self.client.configuration_stores.list_deleted( - api_version="2024-06-01", + def test_configuration_stores_regenerate_key(self, resource_group): + response = self.client.configuration_stores.regenerate_key( + resource_group_name=resource_group.name, + config_store_name="str", + regenerate_key_parameters={"id": "str"}, ) - result = [r for r in response] + # please add some check logic here by yourself # ... @@ -191,7 +183,6 @@ def test_configuration_stores_get_deleted(self, resource_group): response = self.client.configuration_stores.get_deleted( location="str", config_store_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -203,8 +194,15 @@ def test_configuration_stores_begin_purge_deleted(self, resource_group): response = self.client.configuration_stores.begin_purge_deleted( location="str", config_store_name="str", - api_version="2024-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_configuration_stores_list_deleted(self, resource_group): + response = self.client.configuration_stores.list_deleted() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations_async.py index 518d3a1545d0..5ab414fd8ab1 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations_async.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,34 +19,12 @@ class TestAppConfigurationManagementConfigurationStoresOperationsAsync(AzureMgmt def setup_method(self, method): self.client = self.create_mgmt_client(AppConfigurationManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_configuration_stores_list(self, resource_group): - response = self.client.configuration_stores.list( - api_version="2024-06-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_configuration_stores_list_by_resource_group(self, resource_group): - response = self.client.configuration_stores.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-06-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_configuration_stores_get(self, resource_group): response = await self.client.configuration_stores.get( resource_group_name=resource_group.name, config_store_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -62,14 +40,6 @@ async def test_configuration_stores_begin_create(self, resource_group): config_store_creation_parameters={ "location": "str", "sku": {"name": "str"}, - "createMode": "str", - "creationDate": "2020-02-20 00:00:00", - "dataPlaneProxy": {"authenticationMode": "str", "privateLinkDelegation": "str"}, - "defaultKeyValueRevisionRetentionPeriodInSeconds": 0, - "disableLocalAuth": False, - "enablePurgeProtection": False, - "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}}, - "endpoint": "str", "id": "str", "identity": { "principalId": "str", @@ -78,23 +48,38 @@ async def test_configuration_stores_begin_create(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "name": "str", - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", - }, - "provisioningState": "str", - "type": "str", - } - ], - "provisioningState": "str", - "publicNetworkAccess": "str", - "softDeleteRetentionInDays": 7, + "properties": { + "azureFrontDoor": {"resourceId": "str"}, + "createMode": "str", + "creationDate": "2020-02-20 00:00:00", + "dataPlaneProxy": {"authenticationMode": "str", "privateLinkDelegation": "str"}, + "defaultKeyValueRevisionRetentionPeriodInSeconds": 0, + "disableLocalAuth": bool, + "enablePurgeProtection": bool, + "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}}, + "endpoint": "str", + "managedOnBehalfOfConfiguration": {"moboBrokerResources": [{"id": "str"}]}, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "softDeleteRetentionInDays": 0, + "telemetry": {"resourceId": "str"}, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -106,21 +91,6 @@ async def test_configuration_stores_begin_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-06-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_configuration_stores_begin_delete(self, resource_group): - response = await ( - await self.client.configuration_stores.begin_delete( - resource_group_name=resource_group.name, - config_store_name="str", - api_version="2024-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -135,35 +105,68 @@ async def test_configuration_stores_begin_update(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", config_store_update_parameters={ - "dataPlaneProxy": {"authenticationMode": "str", "privateLinkDelegation": "str"}, - "defaultKeyValueRevisionRetentionPeriodInSeconds": 0, - "disableLocalAuth": bool, - "enablePurgeProtection": bool, - "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}}, "identity": { "principalId": "str", "tenantId": "str", "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "publicNetworkAccess": "str", + "properties": { + "azureFrontDoor": {"resourceId": "str"}, + "dataPlaneProxy": {"authenticationMode": "str", "privateLinkDelegation": "str"}, + "defaultKeyValueRevisionRetentionPeriodInSeconds": 0, + "disableLocalAuth": bool, + "enablePurgeProtection": bool, + "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}}, + "publicNetworkAccess": "str", + "telemetry": {"resourceId": "str"}, + }, "sku": {"name": "str"}, "tags": {"str": "str"}, }, - api_version="2024-06-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_configuration_stores_begin_delete(self, resource_group): + response = await ( + await self.client.configuration_stores.begin_delete( + resource_group_name=resource_group.name, + config_store_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_configuration_stores_list_by_resource_group(self, resource_group): + response = self.client.configuration_stores.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_configuration_stores_list(self, resource_group): + response = self.client.configuration_stores.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_configuration_stores_list_keys(self, resource_group): response = self.client.configuration_stores.list_keys( resource_group_name=resource_group.name, config_store_name="str", - api_version="2024-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -176,29 +179,17 @@ async def test_configuration_stores_regenerate_key(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", regenerate_key_parameters={"id": "str"}, - api_version="2024-06-01", ) # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_configuration_stores_list_deleted(self, resource_group): - response = self.client.configuration_stores.list_deleted( - api_version="2024-06-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_configuration_stores_get_deleted(self, resource_group): response = await self.client.configuration_stores.get_deleted( location="str", config_store_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -211,9 +202,16 @@ async def test_configuration_stores_begin_purge_deleted(self, resource_group): await self.client.configuration_stores.begin_purge_deleted( location="str", config_store_name="str", - api_version="2024-06-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_configuration_stores_list_deleted(self, resource_group): + response = self.client.configuration_stores.list_deleted() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations.py index d350148e750c..d3aa4d1589fa 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ def test_key_values_get(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", key_value_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -39,19 +38,28 @@ def test_key_values_create_or_update(self, resource_group): config_store_name="str", key_value_name="str", key_value_parameters={ - "contentType": "str", - "eTag": "str", "id": "str", - "key": "str", - "label": "str", - "lastModified": "2020-02-20 00:00:00", - "locked": bool, "name": "str", - "tags": {"str": "str"}, + "properties": { + "contentType": "str", + "eTag": "str", + "key": "str", + "label": "str", + "lastModified": "2020-02-20 00:00:00", + "locked": bool, + "tags": {"str": "str"}, + "value": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", - "value": "str", }, - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -64,7 +72,6 @@ def test_key_values_begin_delete(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", key_value_name="str", - api_version="2024-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations_async.py index 09374ab45764..8612c6c55b7c 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations_async.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ async def test_key_values_get(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", key_value_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -40,19 +39,28 @@ async def test_key_values_create_or_update(self, resource_group): config_store_name="str", key_value_name="str", key_value_parameters={ - "contentType": "str", - "eTag": "str", "id": "str", - "key": "str", - "label": "str", - "lastModified": "2020-02-20 00:00:00", - "locked": bool, "name": "str", - "tags": {"str": "str"}, + "properties": { + "contentType": "str", + "eTag": "str", + "key": "str", + "label": "str", + "lastModified": "2020-02-20 00:00:00", + "locked": bool, + "tags": {"str": "str"}, + "value": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", - "value": "str", }, - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -66,7 +74,6 @@ async def test_key_values_begin_delete(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", key_value_name="str", - api_version="2024-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations.py index 4a1fb3e1eea2..ddd46cf17ff7 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,22 +20,19 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_operations_check_name_availability(self, resource_group): - response = self.client.operations.check_name_availability( - check_name_availability_parameters={"name": "str", "type": "str"}, - api_version="2024-06-01", - ) - + def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2024-06-01", + def test_operations_check_name_availability(self, resource_group): + response = self.client.operations.check_name_availability( + check_name_availability_parameters={"name": "str", "type": "str"}, ) - result = [r for r in response] + # please add some check logic here by yourself # ... @@ -45,7 +42,6 @@ def test_operations_regional_check_name_availability(self, resource_group): response = self.client.operations.regional_check_name_availability( location="str", check_name_availability_parameters={"name": "str", "type": "str"}, - api_version="2024-06-01", ) # please add some check logic here by yourself diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations_async.py index 06b4e1bea561..99303917fe20 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations_async.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,22 +21,19 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_operations_check_name_availability(self, resource_group): - response = await self.client.operations.check_name_availability( - check_name_availability_parameters={"name": "str", "type": "str"}, - api_version="2024-06-01", - ) - + async def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2024-06-01", + async def test_operations_check_name_availability(self, resource_group): + response = await self.client.operations.check_name_availability( + check_name_availability_parameters={"name": "str", "type": "str"}, ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @@ -46,7 +43,6 @@ async def test_operations_regional_check_name_availability(self, resource_group) response = await self.client.operations.regional_check_name_availability( location="str", check_name_availability_parameters={"name": "str", "type": "str"}, - api_version="2024-06-01", ) # please add some check logic here by yourself diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations.py index 3530603c9bd8..9310e7d517c3 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,18 +18,6 @@ class TestAppConfigurationManagementPrivateEndpointConnectionsOperations(AzureMg def setup_method(self, method): self.client = self.create_mgmt_client(AppConfigurationManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_endpoint_connections_list_by_configuration_store(self, resource_group): - response = self.client.private_endpoint_connections.list_by_configuration_store( - resource_group_name=resource_group.name, - config_store_name="str", - api_version="2024-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_private_endpoint_connections_get(self, resource_group): @@ -37,7 +25,6 @@ def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", private_endpoint_connection_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -53,12 +40,25 @@ def test_private_endpoint_connections_begin_create_or_update(self, resource_grou private_endpoint_connection={ "id": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, - "provisioningState": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", }, - api_version="2024-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -71,8 +71,18 @@ def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", private_endpoint_connection_name="str", - api_version="2024-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_list_by_configuration_store(self, resource_group): + response = self.client.private_endpoint_connections.list_by_configuration_store( + resource_group_name=resource_group.name, + config_store_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations_async.py index ffa6496e64c7..545ced8ed695 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations_async.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,18 +19,6 @@ class TestAppConfigurationManagementPrivateEndpointConnectionsOperationsAsync(Az def setup_method(self, method): self.client = self.create_mgmt_client(AppConfigurationManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_endpoint_connections_list_by_configuration_store(self, resource_group): - response = self.client.private_endpoint_connections.list_by_configuration_store( - resource_group_name=resource_group.name, - config_store_name="str", - api_version="2024-06-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_private_endpoint_connections_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", private_endpoint_connection_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -55,16 +42,25 @@ async def test_private_endpoint_connections_begin_create_or_update(self, resourc private_endpoint_connection={ "id": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", }, - "provisioningState": "str", "type": "str", }, - api_version="2024-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -79,9 +75,19 @@ async def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", private_endpoint_connection_name="str", - api_version="2024-06-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_list_by_configuration_store(self, resource_group): + response = self.client.private_endpoint_connections.list_by_configuration_store( + resource_group_name=resource_group.name, + config_store_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations.py index 7a652beb1e07..feb42447f3cd 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,25 +20,23 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_private_link_resources_list_by_configuration_store(self, resource_group): - response = self.client.private_link_resources.list_by_configuration_store( + def test_private_link_resources_get(self, resource_group): + response = self.client.private_link_resources.get( resource_group_name=resource_group.name, config_store_name="str", - api_version="2024-06-01", + group_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_private_link_resources_get(self, resource_group): - response = self.client.private_link_resources.get( + def test_private_link_resources_list_by_configuration_store(self, resource_group): + response = self.client.private_link_resources.list_by_configuration_store( resource_group_name=resource_group.name, config_store_name="str", - group_name="str", - api_version="2024-06-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations_async.py index 4cb159e26f44..53fd741f74f8 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations_async.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,25 +21,23 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_private_link_resources_list_by_configuration_store(self, resource_group): - response = self.client.private_link_resources.list_by_configuration_store( + async def test_private_link_resources_get(self, resource_group): + response = await self.client.private_link_resources.get( resource_group_name=resource_group.name, config_store_name="str", - api_version="2024-06-01", + group_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_private_link_resources_get(self, resource_group): - response = await self.client.private_link_resources.get( + async def test_private_link_resources_list_by_configuration_store(self, resource_group): + response = self.client.private_link_resources.list_by_configuration_store( resource_group_name=resource_group.name, config_store_name="str", - group_name="str", - api_version="2024-06-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations.py index d5e0993a062b..2299ab49f3f6 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,18 +18,6 @@ class TestAppConfigurationManagementReplicasOperations(AzureMgmtRecordedTestCase def setup_method(self, method): self.client = self.create_mgmt_client(AppConfigurationManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replicas_list_by_configuration_store(self, resource_group): - response = self.client.replicas.list_by_configuration_store( - resource_group_name=resource_group.name, - config_store_name="str", - api_version="2024-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_replicas_get(self, resource_group): @@ -37,7 +25,6 @@ def test_replicas_get(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", replica_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -51,11 +38,10 @@ def test_replicas_begin_create(self, resource_group): config_store_name="str", replica_name="str", replica_creation_parameters={ - "endpoint": "str", "id": "str", "location": "str", "name": "str", - "provisioningState": "str", + "properties": {"endpoint": "str", "provisioningState": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -66,7 +52,6 @@ def test_replicas_begin_create(self, resource_group): }, "type": "str", }, - api_version="2024-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -79,8 +64,18 @@ def test_replicas_begin_delete(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", replica_name="str", - api_version="2024-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_replicas_list_by_configuration_store(self, resource_group): + response = self.client.replicas.list_by_configuration_store( + resource_group_name=resource_group.name, + config_store_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations_async.py index f2ebe1a11286..98aca64ad216 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations_async.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,18 +19,6 @@ class TestAppConfigurationManagementReplicasOperationsAsync(AzureMgmtRecordedTes def setup_method(self, method): self.client = self.create_mgmt_client(AppConfigurationManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replicas_list_by_configuration_store(self, resource_group): - response = self.client.replicas.list_by_configuration_store( - resource_group_name=resource_group.name, - config_store_name="str", - api_version="2024-06-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_replicas_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_replicas_get(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", replica_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -53,11 +40,10 @@ async def test_replicas_begin_create(self, resource_group): config_store_name="str", replica_name="str", replica_creation_parameters={ - "endpoint": "str", "id": "str", "location": "str", "name": "str", - "provisioningState": "str", + "properties": {"endpoint": "str", "provisioningState": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -68,7 +54,6 @@ async def test_replicas_begin_create(self, resource_group): }, "type": "str", }, - api_version="2024-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -83,9 +68,19 @@ async def test_replicas_begin_delete(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", replica_name="str", - api_version="2024-06-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_replicas_list_by_configuration_store(self, resource_group): + response = self.client.replicas.list_by_configuration_store( + resource_group_name=resource_group.name, + config_store_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_snapshots_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_snapshots_operations.py index b981a2028919..b19745b6c82f 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_snapshots_operations.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_snapshots_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ def test_snapshots_get(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", snapshot_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -39,22 +38,31 @@ def test_snapshots_begin_create(self, resource_group): config_store_name="str", snapshot_name="str", body={ - "compositionType": "str", - "created": "2020-02-20 00:00:00", - "etag": "str", - "expires": "2020-02-20 00:00:00", - "filters": [{"key": "str", "label": "str"}], "id": "str", - "itemsCount": 0, "name": "str", - "provisioningState": "str", - "retentionPeriod": 0, - "size": 0, - "status": "str", - "tags": {"str": "str"}, + "properties": { + "filters": [{"key": "str", "label": "str"}], + "compositionType": "str", + "created": "2020-02-20 00:00:00", + "etag": "str", + "expires": "2020-02-20 00:00:00", + "itemsCount": 0, + "provisioningState": "str", + "retentionPeriod": 0, + "size": 0, + "status": "str", + "tags": {"str": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", }, - api_version="2024-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_snapshots_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_snapshots_operations_async.py index befbb3dfd326..ee0a728fb011 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_snapshots_operations_async.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_snapshots_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ async def test_snapshots_get(self, resource_group): resource_group_name=resource_group.name, config_store_name="str", snapshot_name="str", - api_version="2024-06-01", ) # please add some check logic here by yourself @@ -41,22 +40,31 @@ async def test_snapshots_begin_create(self, resource_group): config_store_name="str", snapshot_name="str", body={ - "compositionType": "str", - "created": "2020-02-20 00:00:00", - "etag": "str", - "expires": "2020-02-20 00:00:00", - "filters": [{"key": "str", "label": "str"}], "id": "str", - "itemsCount": 0, "name": "str", - "provisioningState": "str", - "retentionPeriod": 0, - "size": 0, - "status": "str", - "tags": {"str": "str"}, + "properties": { + "filters": [{"key": "str", "label": "str"}], + "compositionType": "str", + "created": "2020-02-20 00:00:00", + "etag": "str", + "expires": "2020-02-20 00:00:00", + "itemsCount": 0, + "provisioningState": "str", + "retentionPeriod": 0, + "size": 0, + "status": "str", + "tags": {"str": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", }, - api_version="2024-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/pyproject.toml b/sdk/appconfiguration/azure-mgmt-appconfiguration/pyproject.toml index cc91747b453d..ca1a60676451 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/pyproject.toml +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/pyproject.toml @@ -1,3 +1,72 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-appconfiguration" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Appconfiguration Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.9" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.appconfiguration._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false black = false @@ -5,3 +74,16 @@ mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-appconfiguration" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "App Configuration Management" +package_doc_id = "?view=azure-python-preview" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +title = "AppConfigurationManagementClient" +exclude_folders = "" diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/sdk_packaging.toml b/sdk/appconfiguration/azure-mgmt-appconfiguration/sdk_packaging.toml deleted file mode 100644 index f2d6d2764524..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/sdk_packaging.toml +++ /dev/null @@ -1,11 +0,0 @@ -[packaging] -package_name = "azure-mgmt-appconfiguration" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "App Configuration Management" -package_doc_id = "?view=azure-python-preview" -is_stable = true -is_arm = true -need_msrestazure = false -need_azuremgmtcore = true -sample_link = "" -title = "AppConfigurationManagementClient" diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py deleted file mode 100644 index a443a61bea7d..000000000000 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-appconfiguration" -PACKAGE_PPRINT_NAME = "App Configuration Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.5.0", - ], - python_requires=">=3.9", -) diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/tests/disable_test_cli_mgmt_appconfiguration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/tests/disable_test_cli_mgmt_appconfiguration.py index 4be523b77db0..f944e353b174 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/tests/disable_test_cli_mgmt_appconfiguration.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/tests/disable_test_cli_mgmt_appconfiguration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/tests/disable_test_cli_mgmt_appconfiguration_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/tests/disable_test_cli_mgmt_appconfiguration_async.py index 578e0fc63f16..284b1d69f5f0 100644 --- a/sdk/appconfiguration/azure-mgmt-appconfiguration/tests/disable_test_cli_mgmt_appconfiguration_async.py +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/tests/disable_test_cli_mgmt_appconfiguration_async.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/tsp-location.yaml b/sdk/appconfiguration/azure-mgmt-appconfiguration/tsp-location.yaml new file mode 100644 index 000000000000..c0b053d2990f --- /dev/null +++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/AppConfiguration +commit: 061d81271653458662f0be74f3fd79eb2b1db60e +repo: Azure/azure-rest-api-specs +additionalDirectories: