From 1d8dd806d0a6647bfec928b29c12a7de5d8d8762 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 27 Feb 2025 06:38:10 +0000 Subject: [PATCH] CodeGen from PR 32741 in Azure/azure-rest-api-specs Merge e64756157328c1d3837acd37bf82342874372d9b into c2afa6e1f7ced1b3c1fdd3518a9d49b44871d7a7 --- .../azure-mgmt-deviceregistry/_meta.json | 2 +- .../apiview-properties.json | 51 +- .../azure/mgmt/deviceregistry/_client.py | 34 +- .../mgmt/deviceregistry/_configuration.py | 7 +- .../azure/mgmt/deviceregistry/_version.py | 2 +- .../azure/mgmt/deviceregistry/aio/_client.py | 34 +- .../mgmt/deviceregistry/aio/_configuration.py | 7 +- .../deviceregistry/aio/operations/__init__.py | 10 - .../aio/operations/_operations.py | 3867 ---------- .../mgmt/deviceregistry/models/__init__.py | 46 - .../mgmt/deviceregistry/models/_enums.py | 25 - .../mgmt/deviceregistry/models/_models.py | 1720 +---- .../deviceregistry/operations/__init__.py | 10 - .../deviceregistry/operations/_operations.py | 6508 +++-------------- .../create_asset_endpoint_profile.py | 2 +- ...ndpoint_profile_with_discovered_aep_ref.py | 2 +- .../create_asset_with_discovered_asset_ref.py | 2 +- .../create_asset_with_external_asset_id.py | 2 +- .../create_asset_without_display_name.py | 2 +- .../create_asset_without_external_asset_id.py | 2 +- .../create_discovered_asset.py | 99 - ...reate_discovered_asset_endpoint_profile.py | 59 - .../generated_samples/create_schema.py | 52 - .../create_schema_registry.py | 53 - .../create_schema_version.py | 51 - .../generated_samples/delete_asset.py | 2 +- .../delete_asset_endpoint_profile.py | 2 +- .../delete_discovered_asset.py | 41 - ...elete_discovered_asset_endpoint_profile.py | 41 - .../generated_samples/delete_schema.py | 42 - .../delete_schema_registry.py | 41 - .../delete_schema_version.py | 43 - .../generated_samples/get_asset.py | 2 +- .../get_asset_endpoint_profile.py | 2 +- ...asset_endpoint_profile_with_sync_status.py | 2 +- .../get_asset_with_sync_status.py | 2 +- .../get_billing_container.py | 2 +- .../generated_samples/get_discovered_asset.py | 42 - .../get_discovered_asset_endpoint_profile.py | 42 - .../generated_samples/get_operation_status.py | 2 +- .../generated_samples/get_schema.py | 43 - .../generated_samples/get_schema_registry.py | 42 - .../generated_samples/get_schema_version.py | 44 - ..._asset_endpoint_profiles_resource_group.py | 2 +- ...st_asset_endpoint_profiles_subscription.py | 2 +- .../list_assets_resource_group.py | 2 +- .../list_assets_subscription.py | 2 +- .../list_billing_containers_subscription.py | 2 +- ..._asset_endpoint_profiles_resource_group.py | 42 - ...ed_asset_endpoint_profiles_subscription.py | 40 - .../list_discovered_assets_resource_group.py | 42 - .../list_discovered_assets_subscription.py | 40 - .../generated_samples/list_operations.py | 2 +- .../list_schema_registries_resource_group.py | 42 - .../list_schema_registries_subscription.py | 40 - .../list_schema_versions_schema.py | 44 - .../list_schemas_schema_registry.py | 43 - .../generated_samples/update_asset.py | 2 +- .../update_asset_endpoint_profile.py | 2 +- .../update_discovered_asset.py | 48 - ...pdate_discovered_asset_endpoint_profile.py | 52 - .../update_schema_registry.py | 49 - ...ered_asset_endpoint_profiles_operations.py | 117 - ...sset_endpoint_profiles_operations_async.py | 124 - ...istry_mgmt_discovered_assets_operations.py | 180 - ...mgmt_discovered_assets_operations_async.py | 187 - ...istry_mgmt_schema_registries_operations.py | 110 - ...mgmt_schema_registries_operations_async.py | 117 - ...egistry_mgmt_schema_versions_operations.py | 90 - ...y_mgmt_schema_versions_operations_async.py | 91 - ...device_registry_mgmt_schemas_operations.py | 88 - ..._registry_mgmt_schemas_operations_async.py | 89 - .../azure-mgmt-deviceregistry/setup.py | 2 +- .../tsp-location.yaml | 2 +- 74 files changed, 1241 insertions(+), 13540 deletions(-) delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset_endpoint_profile.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_registry.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_version.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset_endpoint_profile.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_registry.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_version.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset_endpoint_profile.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_registry.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_version.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_resource_group.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_subscription.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_resource_group.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_subscription.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_resource_group.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_subscription.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_versions_schema.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schemas_schema_registry.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset_endpoint_profile.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_schema_registry.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations_async.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations_async.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations_async.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations_async.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations.py delete mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations_async.py diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json b/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json index 7e52775a5c4..3a3eaa0e3e0 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json @@ -1,5 +1,5 @@ { - "commit": "f6674831693bce0982f08ccf356255248a4c9a8f", + "commit": "fbb413f68a8ca8acf5f03ac50fbf54a63cf1d716", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/deviceregistry/DeviceRegistry.Management", "@azure-tools/typespec-python": "0.38.4" diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json b/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json index cf74bcfe567..d31b729cafd 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json @@ -24,17 +24,6 @@ "azure.mgmt.deviceregistry.models.DataPointBase": "Microsoft.DeviceRegistry.DataPointBase", "azure.mgmt.deviceregistry.models.DataPoint": "Microsoft.DeviceRegistry.DataPoint", "azure.mgmt.deviceregistry.models.Dataset": "Microsoft.DeviceRegistry.Dataset", - "azure.mgmt.deviceregistry.models.DiscoveredAsset": "Microsoft.DeviceRegistry.DiscoveredAsset", - "azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile": "Microsoft.DeviceRegistry.DiscoveredAssetEndpointProfile", - "azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileProperties": "Microsoft.DeviceRegistry.DiscoveredAssetEndpointProfileProperties", - "azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "azure.mgmt.deviceregistry.models.DiscoveredAssetProperties": "Microsoft.DeviceRegistry.DiscoveredAssetProperties", - "azure.mgmt.deviceregistry.models.DiscoveredAssetUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.deviceregistry.models.DiscoveredAssetUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "azure.mgmt.deviceregistry.models.DiscoveredDataPoint": "Microsoft.DeviceRegistry.DiscoveredDataPoint", - "azure.mgmt.deviceregistry.models.DiscoveredDataset": "Microsoft.DeviceRegistry.DiscoveredDataset", - "azure.mgmt.deviceregistry.models.DiscoveredEvent": "Microsoft.DeviceRegistry.DiscoveredEvent", "azure.mgmt.deviceregistry.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", "azure.mgmt.deviceregistry.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", "azure.mgmt.deviceregistry.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", @@ -45,15 +34,6 @@ "azure.mgmt.deviceregistry.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", "azure.mgmt.deviceregistry.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", "azure.mgmt.deviceregistry.models.OperationStatusResult": "Azure.ResourceManager.CommonTypes.OperationStatusResult", - "azure.mgmt.deviceregistry.models.Schema": "Microsoft.DeviceRegistry.Schema", - "azure.mgmt.deviceregistry.models.SchemaProperties": "Microsoft.DeviceRegistry.SchemaProperties", - "azure.mgmt.deviceregistry.models.SchemaRegistry": "Microsoft.DeviceRegistry.SchemaRegistry", - "azure.mgmt.deviceregistry.models.SchemaRegistryProperties": "Microsoft.DeviceRegistry.SchemaRegistryProperties", - "azure.mgmt.deviceregistry.models.SchemaRegistryUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.deviceregistry.models.SchemaRegistryUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "azure.mgmt.deviceregistry.models.SchemaVersion": "Microsoft.DeviceRegistry.SchemaVersion", - "azure.mgmt.deviceregistry.models.SchemaVersionProperties": "Microsoft.DeviceRegistry.SchemaVersionProperties", - "azure.mgmt.deviceregistry.models.SystemAssignedServiceIdentity": "Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentity", "azure.mgmt.deviceregistry.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", "azure.mgmt.deviceregistry.models.Topic": "Microsoft.DeviceRegistry.Topic", "azure.mgmt.deviceregistry.models.UsernamePasswordCredentials": "Microsoft.DeviceRegistry.UsernamePasswordCredentials", @@ -66,9 +46,6 @@ "azure.mgmt.deviceregistry.models.EventObservabilityMode": "Microsoft.DeviceRegistry.EventObservabilityMode", "azure.mgmt.deviceregistry.models.ProvisioningState": "Microsoft.DeviceRegistry.ProvisioningState", "azure.mgmt.deviceregistry.models.AuthenticationMethod": "Microsoft.DeviceRegistry.AuthenticationMethod", - "azure.mgmt.deviceregistry.models.SystemAssignedServiceIdentityType": "Azure.ResourceManager.CommonTypes.SystemAssignedServiceIdentityType", - "azure.mgmt.deviceregistry.models.Format": "Microsoft.DeviceRegistry.Format", - "azure.mgmt.deviceregistry.models.SchemaType": "Microsoft.DeviceRegistry.SchemaType", "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.operations.list": "Azure.ResourceManager.Operations.list", "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.operation_status.get": "Microsoft.DeviceRegistry.OperationStatus.get", "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.get": "Microsoft.DeviceRegistry.Assets.get", @@ -84,32 +61,6 @@ "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.list_by_resource_group": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listByResourceGroup", "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.list_by_subscription": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listBySubscription", "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.billing_containers.get": "Microsoft.DeviceRegistry.BillingContainers.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.billing_containers.list_by_subscription": "Microsoft.DeviceRegistry.BillingContainers.listBySubscription", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_assets.get": "Microsoft.DeviceRegistry.DiscoveredAssets.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_assets.begin_create_or_replace": "Microsoft.DeviceRegistry.DiscoveredAssets.createOrReplace", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_assets.begin_update": "Microsoft.DeviceRegistry.DiscoveredAssets.update", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_assets.begin_delete": "Microsoft.DeviceRegistry.DiscoveredAssets.delete", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_assets.list_by_resource_group": "Microsoft.DeviceRegistry.DiscoveredAssets.listByResourceGroup", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_assets.list_by_subscription": "Microsoft.DeviceRegistry.DiscoveredAssets.listBySubscription", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_asset_endpoint_profiles.get": "Microsoft.DeviceRegistry.DiscoveredAssetEndpointProfiles.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_asset_endpoint_profiles.begin_create_or_replace": "Microsoft.DeviceRegistry.DiscoveredAssetEndpointProfiles.createOrReplace", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_asset_endpoint_profiles.begin_update": "Microsoft.DeviceRegistry.DiscoveredAssetEndpointProfiles.update", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_asset_endpoint_profiles.begin_delete": "Microsoft.DeviceRegistry.DiscoveredAssetEndpointProfiles.delete", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_asset_endpoint_profiles.list_by_resource_group": "Microsoft.DeviceRegistry.DiscoveredAssetEndpointProfiles.listByResourceGroup", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.discovered_asset_endpoint_profiles.list_by_subscription": "Microsoft.DeviceRegistry.DiscoveredAssetEndpointProfiles.listBySubscription", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_registries.get": "Microsoft.DeviceRegistry.SchemaRegistries.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_registries.begin_create_or_replace": "Microsoft.DeviceRegistry.SchemaRegistries.createOrReplace", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_registries.begin_update": "Microsoft.DeviceRegistry.SchemaRegistries.update", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_registries.begin_delete": "Microsoft.DeviceRegistry.SchemaRegistries.delete", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_registries.list_by_resource_group": "Microsoft.DeviceRegistry.SchemaRegistries.listByResourceGroup", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_registries.list_by_subscription": "Microsoft.DeviceRegistry.SchemaRegistries.listBySubscription", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schemas.get": "Microsoft.DeviceRegistry.Schemas.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schemas.create_or_replace": "Microsoft.DeviceRegistry.Schemas.createOrReplace", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schemas.delete": "Microsoft.DeviceRegistry.Schemas.delete", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schemas.list_by_schema_registry": "Microsoft.DeviceRegistry.Schemas.listBySchemaRegistry", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_versions.get": "Microsoft.DeviceRegistry.SchemaVersions.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_versions.create_or_replace": "Microsoft.DeviceRegistry.SchemaVersions.createOrReplace", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_versions.delete": "Microsoft.DeviceRegistry.SchemaVersions.delete", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.schema_versions.list_by_schema": "Microsoft.DeviceRegistry.SchemaVersions.listBySchema" + "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.billing_containers.list_by_subscription": "Microsoft.DeviceRegistry.BillingContainers.listBySubscription" } } \ No newline at end of file diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py index dc5665916ce..f55bd430636 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py @@ -21,20 +21,15 @@ AssetEndpointProfilesOperations, AssetsOperations, BillingContainersOperations, - DiscoveredAssetEndpointProfilesOperations, - DiscoveredAssetsOperations, OperationStatusOperations, Operations, - SchemaRegistriesOperations, - SchemaVersionsOperations, - SchemasOperations, ) if TYPE_CHECKING: from azure.core.credentials import TokenCredential -class DeviceRegistryMgmtClient: # pylint: disable=too-many-instance-attributes +class DeviceRegistryMgmtClient: """Microsoft.DeviceRegistry Resource Provider management API. :ivar operations: Operations operations @@ -48,26 +43,14 @@ class DeviceRegistryMgmtClient: # pylint: disable=too-many-instance-attributes azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations :ivar billing_containers: BillingContainersOperations operations :vartype billing_containers: azure.mgmt.deviceregistry.operations.BillingContainersOperations - :ivar discovered_assets: DiscoveredAssetsOperations operations - :vartype discovered_assets: azure.mgmt.deviceregistry.operations.DiscoveredAssetsOperations - :ivar discovered_asset_endpoint_profiles: DiscoveredAssetEndpointProfilesOperations operations - :vartype discovered_asset_endpoint_profiles: - azure.mgmt.deviceregistry.operations.DiscoveredAssetEndpointProfilesOperations - :ivar schema_registries: SchemaRegistriesOperations operations - :vartype schema_registries: azure.mgmt.deviceregistry.operations.SchemaRegistriesOperations - :ivar schemas: SchemasOperations operations - :vartype schemas: azure.mgmt.deviceregistry.operations.SchemasOperations - :ivar schema_versions: SchemaVersionsOperations operations - :vartype schema_versions: azure.mgmt.deviceregistry.operations.SchemaVersionsOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2024-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-11-01". + 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. @@ -118,17 +101,6 @@ def __init__( self.billing_containers = BillingContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.discovered_assets = DiscoveredAssetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.discovered_asset_endpoint_profiles = DiscoveredAssetEndpointProfilesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.schema_registries = SchemaRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.schemas = SchemasOperations(self._client, self._config, self._serialize, self._deserialize) - self.schema_versions = SchemaVersionsOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_configuration.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_configuration.py index 3581d6e0d1e..e8b9e79fe99 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_configuration.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_configuration.py @@ -29,9 +29,8 @@ class DeviceRegistryMgmtClientConfiguration: # pylint: disable=too-many-instanc :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2024-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-11-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -42,7 +41,7 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py index 0ec13ea52bb..be71c81bd28 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py index df33c758758..f64c7b20c23 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py @@ -21,20 +21,15 @@ AssetEndpointProfilesOperations, AssetsOperations, BillingContainersOperations, - DiscoveredAssetEndpointProfilesOperations, - DiscoveredAssetsOperations, OperationStatusOperations, Operations, - SchemaRegistriesOperations, - SchemaVersionsOperations, - SchemasOperations, ) if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential -class DeviceRegistryMgmtClient: # pylint: disable=too-many-instance-attributes +class DeviceRegistryMgmtClient: """Microsoft.DeviceRegistry Resource Provider management API. :ivar operations: Operations operations @@ -49,26 +44,14 @@ class DeviceRegistryMgmtClient: # pylint: disable=too-many-instance-attributes :ivar billing_containers: BillingContainersOperations operations :vartype billing_containers: azure.mgmt.deviceregistry.aio.operations.BillingContainersOperations - :ivar discovered_assets: DiscoveredAssetsOperations operations - :vartype discovered_assets: azure.mgmt.deviceregistry.aio.operations.DiscoveredAssetsOperations - :ivar discovered_asset_endpoint_profiles: DiscoveredAssetEndpointProfilesOperations operations - :vartype discovered_asset_endpoint_profiles: - azure.mgmt.deviceregistry.aio.operations.DiscoveredAssetEndpointProfilesOperations - :ivar schema_registries: SchemaRegistriesOperations operations - :vartype schema_registries: azure.mgmt.deviceregistry.aio.operations.SchemaRegistriesOperations - :ivar schemas: SchemasOperations operations - :vartype schemas: azure.mgmt.deviceregistry.aio.operations.SchemasOperations - :ivar schema_versions: SchemaVersionsOperations operations - :vartype schema_versions: azure.mgmt.deviceregistry.aio.operations.SchemaVersionsOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2024-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-11-01". + 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. @@ -119,17 +102,6 @@ def __init__( self.billing_containers = BillingContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.discovered_assets = DiscoveredAssetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.discovered_asset_endpoint_profiles = DiscoveredAssetEndpointProfilesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.schema_registries = SchemaRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.schemas = SchemasOperations(self._client, self._config, self._serialize, self._deserialize) - self.schema_versions = SchemaVersionsOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_configuration.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_configuration.py index 7591864c83f..0ab15551a24 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_configuration.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_configuration.py @@ -29,9 +29,8 @@ class DeviceRegistryMgmtClientConfiguration: # pylint: disable=too-many-instanc :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is - "2024-09-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-11-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -42,7 +41,7 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2024-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-11-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/__init__.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/__init__.py index 04984dadf2b..763af1696fc 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/__init__.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/__init__.py @@ -17,11 +17,6 @@ from ._operations import AssetsOperations # type: ignore from ._operations import AssetEndpointProfilesOperations # type: ignore from ._operations import BillingContainersOperations # type: ignore -from ._operations import DiscoveredAssetsOperations # type: ignore -from ._operations import DiscoveredAssetEndpointProfilesOperations # type: ignore -from ._operations import SchemaRegistriesOperations # type: ignore -from ._operations import SchemasOperations # type: ignore -from ._operations import SchemaVersionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -33,11 +28,6 @@ "AssetsOperations", "AssetEndpointProfilesOperations", "BillingContainersOperations", - "DiscoveredAssetsOperations", - "DiscoveredAssetEndpointProfilesOperations", - "SchemaRegistriesOperations", - "SchemasOperations", - "SchemaVersionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py index 6cd05b0b41f..4fc1b5061e2 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py @@ -52,34 +52,8 @@ build_assets_update_request, build_billing_containers_get_request, build_billing_containers_list_by_subscription_request, - build_discovered_asset_endpoint_profiles_create_or_replace_request, - build_discovered_asset_endpoint_profiles_delete_request, - build_discovered_asset_endpoint_profiles_get_request, - build_discovered_asset_endpoint_profiles_list_by_resource_group_request, - build_discovered_asset_endpoint_profiles_list_by_subscription_request, - build_discovered_asset_endpoint_profiles_update_request, - build_discovered_assets_create_or_replace_request, - build_discovered_assets_delete_request, - build_discovered_assets_get_request, - build_discovered_assets_list_by_resource_group_request, - build_discovered_assets_list_by_subscription_request, - build_discovered_assets_update_request, build_operation_status_get_request, build_operations_list_request, - build_schema_registries_create_or_replace_request, - build_schema_registries_delete_request, - build_schema_registries_get_request, - build_schema_registries_list_by_resource_group_request, - build_schema_registries_list_by_subscription_request, - build_schema_registries_update_request, - build_schema_versions_create_or_replace_request, - build_schema_versions_delete_request, - build_schema_versions_get_request, - build_schema_versions_list_by_schema_request, - build_schemas_create_or_replace_request, - build_schemas_delete_request, - build_schemas_get_request, - build_schemas_list_by_schema_registry_request, ) from .._configuration import DeviceRegistryMgmtClientConfiguration @@ -2180,3844 +2154,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - -class DiscoveredAssetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`discovered_assets` 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: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - async def get(self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any) -> _models.DiscoveredAsset: - """Get a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :return: DiscoveredAsset. The DiscoveredAsset is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.DiscoveredAsset - :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.DiscoveredAsset] = kwargs.pop("cls", None) - - _request = build_discovered_assets_get_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DiscoveredAsset, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - async def _create_or_replace_initial( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: Union[_models.DiscoveredAsset, 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(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_assets_create_or_replace_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_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.json()) - 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_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: _models.DiscoveredAsset, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAsset - :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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: Union[_models.DiscoveredAsset, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Is one of the following types: DiscoveredAsset, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAsset or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :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.DiscoveredAsset] = 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_replace_initial( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - resource=resource, - 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.DiscoveredAsset, 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.DiscoveredAsset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiscoveredAsset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - async def _update_initial( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: Union[_models.DiscoveredAssetUpdate, 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(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_assets_update_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_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, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - 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 - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: _models.DiscoveredAssetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdate - :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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - async def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: Union[_models.DiscoveredAssetUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DiscoveredAssetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :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.DiscoveredAsset] = 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, - discovered_asset_name=discovered_asset_name, - properties=properties, - 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.DiscoveredAsset, 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.DiscoveredAsset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiscoveredAsset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - async def _delete_initial( - self, resource_group_name: str, discovered_asset_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_discovered_assets_delete_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_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 [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.json()) - 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - async def begin_delete( - self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_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, - discovered_asset_name=discovered_asset_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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, - ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DiscoveredAsset"]: - """List DiscoveredAsset resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiscoveredAsset - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAsset]] = 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_discovered_assets_list_by_resource_group_request( - resource_group_name=resource_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) - - 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.DiscoveredAsset], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DiscoveredAsset"]: - """List DiscoveredAsset resources by subscription ID. - - :return: An iterator like instance of DiscoveredAsset - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAsset]] = 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_discovered_assets_list_by_subscription_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.DiscoveredAsset], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class DiscoveredAssetEndpointProfilesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`discovered_asset_endpoint_profiles` 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: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - async def get( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> _models.DiscoveredAssetEndpointProfile: - """Get a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :return: DiscoveredAssetEndpointProfile. The DiscoveredAssetEndpointProfile is compatible with - MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile - :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.DiscoveredAssetEndpointProfile] = kwargs.pop("cls", None) - - _request = build_discovered_asset_endpoint_profiles_get_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DiscoveredAssetEndpointProfile, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - async def _create_or_replace_initial( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: Union[_models.DiscoveredAssetEndpointProfile, 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(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_asset_endpoint_profiles_create_or_replace_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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.json()) - 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_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: _models.DiscoveredAssetEndpointProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile - :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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - async def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: Union[_models.DiscoveredAssetEndpointProfile, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Is one of the following types: - DiscoveredAssetEndpointProfile, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :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.DiscoveredAssetEndpointProfile] = 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_replace_initial( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - resource=resource, - 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.DiscoveredAssetEndpointProfile, 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.DiscoveredAssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - async def _update_initial( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: Union[_models.DiscoveredAssetEndpointProfileUpdate, 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(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_asset_endpoint_profiles_update_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - 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 - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: _models.DiscoveredAssetEndpointProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate - :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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - async def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: Union[_models.DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate or - JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :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.DiscoveredAssetEndpointProfile] = 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, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - properties=properties, - 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.DiscoveredAssetEndpointProfile, 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.DiscoveredAssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DiscoveredAssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - async def _delete_initial( - self, resource_group_name: str, discovered_asset_endpoint_profile_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_discovered_asset_endpoint_profiles_delete_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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 [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.json()) - 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - async def begin_delete( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_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, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, - ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DiscoveredAssetEndpointProfile"]: - """List DiscoveredAssetEndpointProfile resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiscoveredAssetEndpointProfile - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAssetEndpointProfile]] = 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_discovered_asset_endpoint_profiles_list_by_resource_group_request( - resource_group_name=resource_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) - - 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.DiscoveredAssetEndpointProfile], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DiscoveredAssetEndpointProfile"]: - """List DiscoveredAssetEndpointProfile resources by subscription ID. - - :return: An iterator like instance of DiscoveredAssetEndpointProfile - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAssetEndpointProfile]] = 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_discovered_asset_endpoint_profiles_list_by_subscription_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.DiscoveredAssetEndpointProfile], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class SchemaRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`schema_registries` 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: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, - ) - async def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any) -> _models.SchemaRegistry: - """Get a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :return: SchemaRegistry. The SchemaRegistry is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaRegistry - :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.SchemaRegistry] = kwargs.pop("cls", None) - - _request = build_schema_registries_get_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SchemaRegistry, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, - ) - async def _create_or_replace_initial( - self, - resource_group_name: str, - schema_registry_name: str, - resource: Union[_models.SchemaRegistry, 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(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schema_registries_create_or_replace_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_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.json()) - 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_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: _models.SchemaRegistry, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaRegistry - :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 SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, - ) - async def begin_create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: Union[_models.SchemaRegistry, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Is one of the following types: SchemaRegistry, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaRegistry or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :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.SchemaRegistry] = 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_replace_initial( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - resource=resource, - 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.SchemaRegistry, 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.SchemaRegistry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SchemaRegistry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, - ) - async def _update_initial( - self, - resource_group_name: str, - schema_registry_name: str, - properties: Union[_models.SchemaRegistryUpdate, 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(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schema_registries_update_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_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, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - 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 - - @overload - async def begin_update( - self, - resource_group_name: str, - schema_registry_name: str, - properties: _models.SchemaRegistryUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryUpdate - :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 SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - schema_registry_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - schema_registry_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, - ) - async def begin_update( - self, - resource_group_name: str, - schema_registry_name: str, - properties: Union[_models.SchemaRegistryUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param properties: The resource properties to be updated. Is one of the following types: - SchemaRegistryUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns SchemaRegistry. The SchemaRegistry is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :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.SchemaRegistry] = 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, - schema_registry_name=schema_registry_name, - properties=properties, - 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.SchemaRegistry, 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.SchemaRegistry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SchemaRegistry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, - ) - async def _delete_initial( - self, resource_group_name: str, schema_registry_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_schema_registries_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_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 [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.json()) - 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, - ) - async def begin_delete( - self, resource_group_name: str, schema_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_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, - schema_registry_name=schema_registry_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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, - ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SchemaRegistry"]: - """List SchemaRegistry resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of SchemaRegistry - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SchemaRegistry]] = 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_schema_registries_list_by_resource_group_request( - resource_group_name=resource_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) - - 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.SchemaRegistry], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SchemaRegistry"]: - """List SchemaRegistry resources by subscription ID. - - :return: An iterator like instance of SchemaRegistry - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.SchemaRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SchemaRegistry]] = 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_schema_registries_list_by_subscription_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.SchemaRegistry], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class SchemasOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`schemas` 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: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, - ) - async def get( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> _models.Schema: - """Get a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :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.Schema] = kwargs.pop("cls", None) - - _request = build_schemas_get_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Schema, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: _models.Schema, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schema: - """Create a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.Schema - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schema: - """Create a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Schema: - """Create a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: 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: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "content_type", - "accept", - ] - }, - ) - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: Union[_models.Schema, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.Schema: - """Create a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Is one of the following types: Schema, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.Schema or JSON or IO[bytes] - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :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.Schema] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schemas_create_or_replace_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_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, 201]: - 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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Schema, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, - ) - async def delete( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> None: - """Delete a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: None - :rtype: None - :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[None] = kwargs.pop("cls", None) - - _request = build_schemas_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_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 = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, - ) - def list_by_schema_registry( - self, resource_group_name: str, schema_registry_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Schema"]: - """List Schema resources by SchemaRegistry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :return: An iterator like instance of Schema - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.Schema] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Schema]] = 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_schemas_list_by_schema_registry_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_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.Schema], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class SchemaVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.aio.DeviceRegistryMgmtClient`'s - :attr:`schema_versions` 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: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "accept", - ] - }, - ) - async def get( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - **kwargs: Any - ) -> _models.SchemaVersion: - """Get a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :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.SchemaVersion] = kwargs.pop("cls", None) - - _request = build_schema_versions_get_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SchemaVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: _models.SchemaVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: 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: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "content_type", - "accept", - ] - }, - ) - async def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: Union[_models.SchemaVersion, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Is one of the following types: SchemaVersion, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaVersion or JSON or IO[bytes] - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :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.SchemaVersion] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schema_versions_create_or_replace_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_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, 201]: - 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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SchemaVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "accept", - ] - }, - ) - async def delete( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - **kwargs: Any - ) -> None: - """Delete a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :return: None - :rtype: None - :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[None] = kwargs.pop("cls", None) - - _request = build_schema_versions_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_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 = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, - ) - def list_by_schema( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SchemaVersion"]: - """List SchemaVersion resources by Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: An iterator like instance of SchemaVersion - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.deviceregistry.models.SchemaVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SchemaVersion]] = 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_schema_versions_list_by_schema_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_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.SchemaVersion], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/__init__.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/__init__.py index 37b8186abf0..468137044b2 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/__init__.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/__init__.py @@ -34,17 +34,6 @@ DataPoint, DataPointBase, Dataset, - DiscoveredAsset, - DiscoveredAssetEndpointProfile, - DiscoveredAssetEndpointProfileProperties, - DiscoveredAssetEndpointProfileUpdate, - DiscoveredAssetEndpointProfileUpdateProperties, - DiscoveredAssetProperties, - DiscoveredAssetUpdate, - DiscoveredAssetUpdateProperties, - DiscoveredDataPoint, - DiscoveredDataset, - DiscoveredEvent, ErrorAdditionalInfo, ErrorDetail, ErrorResponse, @@ -57,15 +46,6 @@ OperationStatusResult, ProxyResource, Resource, - Schema, - SchemaProperties, - SchemaRegistry, - SchemaRegistryProperties, - SchemaRegistryUpdate, - SchemaRegistryUpdateProperties, - SchemaVersion, - SchemaVersionProperties, - SystemAssignedServiceIdentity, SystemData, Topic, TrackedResource, @@ -79,11 +59,8 @@ CreatedByType, DataPointObservabilityMode, EventObservabilityMode, - Format, Origin, ProvisioningState, - SchemaType, - SystemAssignedServiceIdentityType, TopicRetainType, ) from ._patch import __all__ as _patch_all @@ -111,17 +88,6 @@ "DataPoint", "DataPointBase", "Dataset", - "DiscoveredAsset", - "DiscoveredAssetEndpointProfile", - "DiscoveredAssetEndpointProfileProperties", - "DiscoveredAssetEndpointProfileUpdate", - "DiscoveredAssetEndpointProfileUpdateProperties", - "DiscoveredAssetProperties", - "DiscoveredAssetUpdate", - "DiscoveredAssetUpdateProperties", - "DiscoveredDataPoint", - "DiscoveredDataset", - "DiscoveredEvent", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -134,15 +100,6 @@ "OperationStatusResult", "ProxyResource", "Resource", - "Schema", - "SchemaProperties", - "SchemaRegistry", - "SchemaRegistryProperties", - "SchemaRegistryUpdate", - "SchemaRegistryUpdateProperties", - "SchemaVersion", - "SchemaVersionProperties", - "SystemAssignedServiceIdentity", "SystemData", "Topic", "TrackedResource", @@ -153,11 +110,8 @@ "CreatedByType", "DataPointObservabilityMode", "EventObservabilityMode", - "Format", "Origin", "ProvisioningState", - "SchemaType", - "SystemAssignedServiceIdentityType", "TopicRetainType", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_enums.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_enums.py index 2e272e8503d..5d45ddc4717 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_enums.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_enums.py @@ -67,15 +67,6 @@ class EventObservabilityMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Map as log to OpenTelemetry.""" -class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Defines the schema format.""" - - JSON_SCHEMA_DRAFT7 = "JsonSchema/draft-07" - """JSON Schema version draft 7 format""" - DELTA1_0 = "Delta/1.0" - """Delta format""" - - class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". @@ -104,22 +95,6 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource is deleting.""" -class SchemaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Defines the schema type.""" - - MESSAGE_SCHEMA = "MessageSchema" - """Message Schema schema type""" - - -class SystemAssignedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (either system assigned, or none).""" - - NONE = "None" - """No managed system identity.""" - SYSTEM_ASSIGNED = "SystemAssigned" - """System assigned managed system identity.""" - - class TopicRetainType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Topic retain types.""" diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py index 6861b5c0a85..1e48551e1d2 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py @@ -1149,1401 +1149,70 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DiscoveredAsset(TrackedResource): - """Discovered Asset definition. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.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 resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetProperties - :ivar extended_location: The extended location. Required. - :vartype extended_location: ~azure.mgmt.deviceregistry.models.ExtendedLocation - """ - - properties: Optional["_models.DiscoveredAssetProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The resource-specific properties for this resource.""" - extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) - """The extended location. Required.""" - - @overload - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.DiscoveredAssetProperties"] = 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 DiscoveredAssetEndpointProfile(TrackedResource): - """Discovered Asset Endpoint Profile definition. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.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 resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileProperties - :ivar extended_location: The extended location. Required. - :vartype extended_location: ~azure.mgmt.deviceregistry.models.ExtendedLocation - """ - - properties: Optional["_models.DiscoveredAssetEndpointProfileProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The resource-specific properties for this resource.""" - extended_location: "_models.ExtendedLocation" = rest_field(name="extendedLocation", visibility=["read", "create"]) - """The extended location. Required.""" - - @overload - def __init__( - self, - *, - location: str, - extended_location: "_models.ExtendedLocation", - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.DiscoveredAssetEndpointProfileProperties"] = 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 DiscoveredAssetEndpointProfileProperties(_model_base.Model): - """Defines the Discovered Asset Endpoint Profile properties. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar target_address: The local valid URI specifying the network address/DNS name of a - southbound device. The scheme part of the targetAddress URI specifies the type of the device. - The additionalConfiguration field holds further connector type specific configuration. - Required. - :vartype target_address: str - :ivar additional_configuration: Stringified JSON that contains connectivity type specific - further configuration (e.g. OPC UA, Modbus, ONVIF). - :vartype additional_configuration: str - :ivar supported_authentication_methods: List of supported authentication methods supported by - the target server. - :vartype supported_authentication_methods: list[str or - ~azure.mgmt.deviceregistry.models.AuthenticationMethod] - :ivar endpoint_profile_type: Defines the configuration for the connector type that is being - used with the endpoint profile. Required. - :vartype endpoint_profile_type: str - :ivar discovery_id: Identifier used to detect changes in the asset endpoint profile. Required. - :vartype discovery_id: str - :ivar version: An integer that is incremented each time the resource is modified. Required. - :vartype version: int - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState - """ - - target_address: str = rest_field(name="targetAddress", visibility=["read", "create", "update", "delete", "query"]) - """The local valid URI specifying the network address/DNS name of a southbound device. The scheme - part of the targetAddress URI specifies the type of the device. The additionalConfiguration - field holds further connector type specific configuration. Required.""" - additional_configuration: Optional[str] = rest_field( - name="additionalConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, - Modbus, ONVIF).""" - supported_authentication_methods: Optional[List[Union[str, "_models.AuthenticationMethod"]]] = rest_field( - name="supportedAuthenticationMethods", visibility=["read", "create", "update", "delete", "query"] - ) - """List of supported authentication methods supported by the target server.""" - endpoint_profile_type: str = rest_field( - name="endpointProfileType", visibility=["read", "create", "update", "delete", "query"] - ) - """Defines the configuration for the connector type that is being used with the endpoint profile. - Required.""" - discovery_id: str = rest_field(name="discoveryId", visibility=["read", "create", "update", "delete", "query"]) - """Identifier used to detect changes in the asset endpoint profile. Required.""" - version: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An integer that is incremented each time the resource is modified. Required.""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" - - @overload - def __init__( - self, - *, - target_address: str, - endpoint_profile_type: str, - discovery_id: str, - version: int, - additional_configuration: Optional[str] = None, - supported_authentication_methods: Optional[List[Union[str, "_models.AuthenticationMethod"]]] = 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 DiscoveredAssetEndpointProfileUpdate(_model_base.Model): - """The type used for update operations of the DiscoveredAssetEndpointProfile. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The resource-specific properties for this resource. - :vartype properties: - ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdateProperties - """ - - tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Resource tags.""" - properties: Optional["_models.DiscoveredAssetEndpointProfileUpdateProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The resource-specific properties for this resource.""" - - @overload - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.DiscoveredAssetEndpointProfileUpdateProperties"] = 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 DiscoveredAssetEndpointProfileUpdateProperties(_model_base.Model): # pylint: disable=name-too-long - """The updatable properties of the DiscoveredAssetEndpointProfile. - - :ivar target_address: The local valid URI specifying the network address/DNS name of a - southbound device. The scheme part of the targetAddress URI specifies the type of the device. - The additionalConfiguration field holds further connector type specific configuration. - :vartype target_address: str - :ivar additional_configuration: Stringified JSON that contains connectivity type specific - further configuration (e.g. OPC UA, Modbus, ONVIF). - :vartype additional_configuration: str - :ivar supported_authentication_methods: List of supported authentication methods supported by - the target server. - :vartype supported_authentication_methods: list[str or - ~azure.mgmt.deviceregistry.models.AuthenticationMethod] - :ivar endpoint_profile_type: Defines the configuration for the connector type that is being - used with the endpoint profile. - :vartype endpoint_profile_type: str - :ivar discovery_id: Identifier used to detect changes in the asset endpoint profile. - :vartype discovery_id: str - :ivar version: An integer that is incremented each time the resource is modified. - :vartype version: int - """ - - target_address: Optional[str] = rest_field( - name="targetAddress", visibility=["read", "create", "update", "delete", "query"] - ) - """The local valid URI specifying the network address/DNS name of a southbound device. The scheme - part of the targetAddress URI specifies the type of the device. The additionalConfiguration - field holds further connector type specific configuration.""" - additional_configuration: Optional[str] = rest_field( - name="additionalConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, - Modbus, ONVIF).""" - supported_authentication_methods: Optional[List[Union[str, "_models.AuthenticationMethod"]]] = rest_field( - name="supportedAuthenticationMethods", visibility=["read", "create", "update", "delete", "query"] - ) - """List of supported authentication methods supported by the target server.""" - endpoint_profile_type: Optional[str] = rest_field( - name="endpointProfileType", visibility=["read", "create", "update", "delete", "query"] - ) - """Defines the configuration for the connector type that is being used with the endpoint profile.""" - discovery_id: Optional[str] = rest_field( - name="discoveryId", visibility=["read", "create", "update", "delete", "query"] - ) - """Identifier used to detect changes in the asset endpoint profile.""" - version: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An integer that is incremented each time the resource is modified.""" - - @overload - def __init__( - self, - *, - target_address: Optional[str] = None, - additional_configuration: Optional[str] = None, - supported_authentication_methods: Optional[List[Union[str, "_models.AuthenticationMethod"]]] = None, - endpoint_profile_type: Optional[str] = None, - discovery_id: Optional[str] = None, - version: Optional[int] = 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 DiscoveredAssetProperties(_model_base.Model): - """Defines the discovered asset properties. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar asset_endpoint_profile_ref: A reference to the asset endpoint profile (connection - information) used by brokers to connect to an endpoint that provides data points for this - asset. Must provide asset endpoint profile name. Required. - :vartype asset_endpoint_profile_ref: str - :ivar discovery_id: Identifier used to detect changes in the asset. Required. - :vartype discovery_id: str - :ivar version: An integer that is incremented each time the resource is modified. Required. - :vartype version: int - :ivar manufacturer: Asset manufacturer name. - :vartype manufacturer: str - :ivar manufacturer_uri: Asset manufacturer URI. - :vartype manufacturer_uri: str - :ivar model: Asset model name. - :vartype model: str - :ivar product_code: Asset product code. - :vartype product_code: str - :ivar hardware_revision: Revision number of the hardware. - :vartype hardware_revision: str - :ivar software_revision: Revision number of the software. - :vartype software_revision: str - :ivar documentation_uri: Reference to the documentation. - :vartype documentation_uri: str - :ivar serial_number: Asset serial number. - :vartype serial_number: str - :ivar default_datasets_configuration: Stringified JSON that contains connector-specific default - configuration for all datasets. Each dataset can have its own configuration that overrides the - default settings here. - :vartype default_datasets_configuration: str - :ivar default_events_configuration: Stringified JSON that contains connector-specific default - configuration for all events. Each event can have its own configuration that overrides the - default settings here. - :vartype default_events_configuration: str - :ivar default_topic: Object that describes the default topic information for the asset. - :vartype default_topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar datasets: Array of datasets that are part of the asset. Each dataset spec describes the - data points that make up the set. - :vartype datasets: list[~azure.mgmt.deviceregistry.models.DiscoveredDataset] - :ivar events: Array of events that are part of the asset. Each event can have per-event - configuration. - :vartype events: list[~azure.mgmt.deviceregistry.models.DiscoveredEvent] - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState - """ - - asset_endpoint_profile_ref: str = rest_field(name="assetEndpointProfileRef", visibility=["read", "create"]) - """A reference to the asset endpoint profile (connection information) used by brokers to connect - to an endpoint that provides data points for this asset. Must provide asset endpoint profile - name. Required.""" - discovery_id: str = rest_field(name="discoveryId", visibility=["read", "create", "update", "delete", "query"]) - """Identifier used to detect changes in the asset. Required.""" - version: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An integer that is incremented each time the resource is modified. Required.""" - manufacturer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Asset manufacturer name.""" - manufacturer_uri: Optional[str] = rest_field( - name="manufacturerUri", visibility=["read", "create", "update", "delete", "query"] - ) - """Asset manufacturer URI.""" - model: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Asset model name.""" - product_code: Optional[str] = rest_field( - name="productCode", visibility=["read", "create", "update", "delete", "query"] - ) - """Asset product code.""" - hardware_revision: Optional[str] = rest_field( - name="hardwareRevision", visibility=["read", "create", "update", "delete", "query"] - ) - """Revision number of the hardware.""" - software_revision: Optional[str] = rest_field( - name="softwareRevision", visibility=["read", "create", "update", "delete", "query"] - ) - """Revision number of the software.""" - documentation_uri: Optional[str] = rest_field( - name="documentationUri", visibility=["read", "create", "update", "delete", "query"] - ) - """Reference to the documentation.""" - serial_number: Optional[str] = rest_field( - name="serialNumber", visibility=["read", "create", "update", "delete", "query"] - ) - """Asset serial number.""" - default_datasets_configuration: Optional[str] = rest_field( - name="defaultDatasetsConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connector-specific default configuration for all datasets. Each - dataset can have its own configuration that overrides the default settings here.""" - default_events_configuration: Optional[str] = rest_field( - name="defaultEventsConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connector-specific default configuration for all events. Each - event can have its own configuration that overrides the default settings here.""" - default_topic: Optional["_models.Topic"] = rest_field( - name="defaultTopic", visibility=["read", "create", "update", "delete", "query"] - ) - """Object that describes the default topic information for the asset.""" - datasets: Optional[List["_models.DiscoveredDataset"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Array of datasets that are part of the asset. Each dataset spec describes the data points that - make up the set.""" - events: Optional[List["_models.DiscoveredEvent"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Array of events that are part of the asset. Each event can have per-event configuration.""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" - - @overload - def __init__( - self, - *, - asset_endpoint_profile_ref: str, - discovery_id: str, - version: int, - manufacturer: Optional[str] = None, - manufacturer_uri: Optional[str] = None, - model: Optional[str] = None, - product_code: Optional[str] = None, - hardware_revision: Optional[str] = None, - software_revision: Optional[str] = None, - documentation_uri: Optional[str] = None, - serial_number: Optional[str] = None, - default_datasets_configuration: Optional[str] = None, - default_events_configuration: Optional[str] = None, - default_topic: Optional["_models.Topic"] = None, - datasets: Optional[List["_models.DiscoveredDataset"]] = None, - events: Optional[List["_models.DiscoveredEvent"]] = 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 DiscoveredAssetUpdate(_model_base.Model): - """The type used for update operations of the DiscoveredAsset. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdateProperties - """ - - tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Resource tags.""" - properties: Optional["_models.DiscoveredAssetUpdateProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The resource-specific properties for this resource.""" - - @overload - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.DiscoveredAssetUpdateProperties"] = 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 DiscoveredAssetUpdateProperties(_model_base.Model): - """The updatable properties of the DiscoveredAsset. - - :ivar discovery_id: Identifier used to detect changes in the asset. - :vartype discovery_id: str - :ivar version: An integer that is incremented each time the resource is modified. - :vartype version: int - :ivar manufacturer: Asset manufacturer name. - :vartype manufacturer: str - :ivar manufacturer_uri: Asset manufacturer URI. - :vartype manufacturer_uri: str - :ivar model: Asset model name. - :vartype model: str - :ivar product_code: Asset product code. - :vartype product_code: str - :ivar hardware_revision: Revision number of the hardware. - :vartype hardware_revision: str - :ivar software_revision: Revision number of the software. - :vartype software_revision: str - :ivar documentation_uri: Reference to the documentation. - :vartype documentation_uri: str - :ivar serial_number: Asset serial number. - :vartype serial_number: str - :ivar default_datasets_configuration: Stringified JSON that contains connector-specific default - configuration for all datasets. Each dataset can have its own configuration that overrides the - default settings here. - :vartype default_datasets_configuration: str - :ivar default_events_configuration: Stringified JSON that contains connector-specific default - configuration for all events. Each event can have its own configuration that overrides the - default settings here. - :vartype default_events_configuration: str - :ivar default_topic: Object that describes the default topic information for the asset. - :vartype default_topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar datasets: Array of datasets that are part of the asset. Each dataset spec describes the - data points that make up the set. - :vartype datasets: list[~azure.mgmt.deviceregistry.models.DiscoveredDataset] - :ivar events: Array of events that are part of the asset. Each event can have per-event - configuration. - :vartype events: list[~azure.mgmt.deviceregistry.models.DiscoveredEvent] - """ - - discovery_id: Optional[str] = rest_field( - name="discoveryId", visibility=["read", "create", "update", "delete", "query"] - ) - """Identifier used to detect changes in the asset.""" - version: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An integer that is incremented each time the resource is modified.""" - manufacturer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Asset manufacturer name.""" - manufacturer_uri: Optional[str] = rest_field( - name="manufacturerUri", visibility=["read", "create", "update", "delete", "query"] - ) - """Asset manufacturer URI.""" - model: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Asset model name.""" - product_code: Optional[str] = rest_field( - name="productCode", visibility=["read", "create", "update", "delete", "query"] - ) - """Asset product code.""" - hardware_revision: Optional[str] = rest_field( - name="hardwareRevision", visibility=["read", "create", "update", "delete", "query"] - ) - """Revision number of the hardware.""" - software_revision: Optional[str] = rest_field( - name="softwareRevision", visibility=["read", "create", "update", "delete", "query"] - ) - """Revision number of the software.""" - documentation_uri: Optional[str] = rest_field( - name="documentationUri", visibility=["read", "create", "update", "delete", "query"] - ) - """Reference to the documentation.""" - serial_number: Optional[str] = rest_field( - name="serialNumber", visibility=["read", "create", "update", "delete", "query"] - ) - """Asset serial number.""" - default_datasets_configuration: Optional[str] = rest_field( - name="defaultDatasetsConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connector-specific default configuration for all datasets. Each - dataset can have its own configuration that overrides the default settings here.""" - default_events_configuration: Optional[str] = rest_field( - name="defaultEventsConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connector-specific default configuration for all events. Each - event can have its own configuration that overrides the default settings here.""" - default_topic: Optional["_models.Topic"] = rest_field( - name="defaultTopic", visibility=["read", "create", "update", "delete", "query"] - ) - """Object that describes the default topic information for the asset.""" - datasets: Optional[List["_models.DiscoveredDataset"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Array of datasets that are part of the asset. Each dataset spec describes the data points that - make up the set.""" - events: Optional[List["_models.DiscoveredEvent"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Array of events that are part of the asset. Each event can have per-event configuration.""" - - @overload - def __init__( - self, - *, - discovery_id: Optional[str] = None, - version: Optional[int] = None, - manufacturer: Optional[str] = None, - manufacturer_uri: Optional[str] = None, - model: Optional[str] = None, - product_code: Optional[str] = None, - hardware_revision: Optional[str] = None, - software_revision: Optional[str] = None, - documentation_uri: Optional[str] = None, - serial_number: Optional[str] = None, - default_datasets_configuration: Optional[str] = None, - default_events_configuration: Optional[str] = None, - default_topic: Optional["_models.Topic"] = None, - datasets: Optional[List["_models.DiscoveredDataset"]] = None, - events: Optional[List["_models.DiscoveredEvent"]] = 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 DiscoveredDataPoint(_model_base.Model): - """Defines the data point properties. - - - :ivar name: The name of the data point. Required. - :vartype name: str - :ivar data_source: The address of the source of the data in the asset (e.g. URL) so that a - client can access the data source on the asset. Required. - :vartype data_source: str - :ivar data_point_configuration: Stringified JSON that contains connector-specific configuration - for the data point. For OPC UA, this could include configuration like, publishingInterval, - samplingInterval, and queueSize. - :vartype data_point_configuration: str - :ivar last_updated_on: UTC timestamp indicating when the data point was added or modified. - :vartype last_updated_on: ~datetime.datetime - """ - - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the data point. Required.""" - data_source: str = rest_field(name="dataSource", visibility=["read", "create", "update", "delete", "query"]) - """The address of the source of the data in the asset (e.g. URL) so that a client can access the - data source on the asset. Required.""" - data_point_configuration: Optional[str] = rest_field( - name="dataPointConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, - this could include configuration like, publishingInterval, samplingInterval, and queueSize.""" - last_updated_on: Optional[datetime.datetime] = rest_field( - name="lastUpdatedOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """UTC timestamp indicating when the data point was added or modified.""" - - @overload - def __init__( - self, - *, - name: str, - data_source: str, - data_point_configuration: Optional[str] = None, - last_updated_on: 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 DiscoveredDataset(_model_base.Model): - """Defines the dataset properties. - - - :ivar name: Name of the dataset. Required. - :vartype name: str - :ivar dataset_configuration: Stringified JSON that contains connector-specific properties that - describes configuration for the specific dataset. - :vartype dataset_configuration: str - :ivar topic: Object that describes the topic information for the specific dataset. - :vartype topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar data_points: Array of data points that are part of the dataset. Each data point can have - per-data point configuration. - :vartype data_points: list[~azure.mgmt.deviceregistry.models.DiscoveredDataPoint] - """ - - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the dataset. Required.""" - dataset_configuration: Optional[str] = rest_field( - name="datasetConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connector-specific properties that describes configuration for - the specific dataset.""" - topic: Optional["_models.Topic"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Object that describes the topic information for the specific dataset.""" - data_points: Optional[List["_models.DiscoveredDataPoint"]] = rest_field( - name="dataPoints", visibility=["read", "create", "update", "delete", "query"] - ) - """Array of data points that are part of the dataset. Each data point can have per-data point - configuration.""" - - @overload - def __init__( - self, - *, - name: str, - dataset_configuration: Optional[str] = None, - topic: Optional["_models.Topic"] = None, - data_points: Optional[List["_models.DiscoveredDataPoint"]] = 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 DiscoveredEvent(_model_base.Model): - """Defines the event properties. - - - :ivar name: The name of the event. Required. - :vartype name: str - :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that - a client can access the event on the asset. Required. - :vartype event_notifier: str - :ivar event_configuration: Stringified JSON that contains connector-specific configuration for - the event. For OPC UA, this could include configuration like, publishingInterval, - samplingInterval, and queueSize. - :vartype event_configuration: str - :ivar topic: Object that describes the topic information for the specific event. - :vartype topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar last_updated_on: UTC timestamp indicating when the event was added or modified. - :vartype last_updated_on: ~datetime.datetime - """ - - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the event. Required.""" - event_notifier: str = rest_field(name="eventNotifier", visibility=["read", "create", "update", "delete", "query"]) - """The address of the notifier of the event in the asset (e.g. URL) so that a client can access - the event on the asset. Required.""" - event_configuration: Optional[str] = rest_field( - name="eventConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this - could include configuration like, publishingInterval, samplingInterval, and queueSize.""" - topic: Optional["_models.Topic"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Object that describes the topic information for the specific event.""" - last_updated_on: Optional[datetime.datetime] = rest_field( - name="lastUpdatedOn", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """UTC timestamp indicating when the event was added or modified.""" - - @overload - def __init__( - self, - *, - name: str, - event_notifier: str, - event_configuration: Optional[str] = None, - topic: Optional["_models.Topic"] = None, - last_updated_on: 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 ErrorAdditionalInfo(_model_base.Model): - """The resource management error additional info. - - Readonly 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: 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_base.Model): - """The error detail. - - Readonly 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.deviceregistry.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.deviceregistry.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_base.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. - - :ivar error: The error object. - :vartype error: ~azure.mgmt.deviceregistry.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 EventBase(_model_base.Model): - """Defines the event properties. - - - :ivar name: The name of the event. Required. - :vartype name: str - :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that - a client can access the event on the asset. Required. - :vartype event_notifier: str - :ivar event_configuration: Stringified JSON that contains connector-specific configuration for - the event. For OPC UA, this could include configuration like, publishingInterval, - samplingInterval, and queueSize. - :vartype event_configuration: str - :ivar topic: Object that describes the topic information for the specific event. - :vartype topic: ~azure.mgmt.deviceregistry.models.Topic - """ - - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the event. Required.""" - event_notifier: str = rest_field(name="eventNotifier", visibility=["read", "create", "update", "delete", "query"]) - """The address of the notifier of the event in the asset (e.g. URL) so that a client can access - the event on the asset. Required.""" - event_configuration: Optional[str] = rest_field( - name="eventConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this - could include configuration like, publishingInterval, samplingInterval, and queueSize.""" - topic: Optional["_models.Topic"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Object that describes the topic information for the specific event.""" - - @overload - def __init__( - self, - *, - name: str, - event_notifier: str, - event_configuration: Optional[str] = None, - topic: Optional["_models.Topic"] = 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 Event(EventBase): - """Defines the event properties. - - - :ivar name: The name of the event. Required. - :vartype name: str - :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that - a client can access the event on the asset. Required. - :vartype event_notifier: str - :ivar event_configuration: Stringified JSON that contains connector-specific configuration for - the event. For OPC UA, this could include configuration like, publishingInterval, - samplingInterval, and queueSize. - :vartype event_configuration: str - :ivar topic: Object that describes the topic information for the specific event. - :vartype topic: ~azure.mgmt.deviceregistry.models.Topic - :ivar observability_mode: An indication of how the event should be mapped to OpenTelemetry. - Known values are: "None" and "Log". - :vartype observability_mode: str or ~azure.mgmt.deviceregistry.models.EventObservabilityMode - """ - - observability_mode: Optional[Union[str, "_models.EventObservabilityMode"]] = rest_field( - name="observabilityMode", visibility=["read", "create", "update", "delete", "query"] - ) - """An indication of how the event should be mapped to OpenTelemetry. Known values are: \"None\" - and \"Log\".""" - - @overload - def __init__( - self, - *, - name: str, - event_notifier: str, - event_configuration: Optional[str] = None, - topic: Optional["_models.Topic"] = None, - observability_mode: Optional[Union[str, "_models.EventObservabilityMode"]] = 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 ExtendedLocation(_model_base.Model): - """The extended location. - - - :ivar type: The extended location type. Required. - :vartype type: str - :ivar name: The extended location name. Required. - :vartype name: str - """ - - type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The extended location type. Required.""" - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The extended location name. Required.""" - - @overload - def __init__( - self, - *, - type: str, - 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 MessageSchemaReference(_model_base.Model): - """Defines the message schema reference properties. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar schema_registry_namespace: The message schema registry namespace. Required. - :vartype schema_registry_namespace: str - :ivar schema_name: The message schema name. Required. - :vartype schema_name: str - :ivar schema_version: The message schema version. Required. - :vartype schema_version: str - """ - - schema_registry_namespace: str = rest_field(name="schemaRegistryNamespace", visibility=["read"]) - """The message schema registry namespace. Required.""" - schema_name: str = rest_field(name="schemaName", visibility=["read"]) - """The message schema name. Required.""" - schema_version: str = rest_field(name="schemaVersion", visibility=["read"]) - """The message schema version. Required.""" - - -class Operation(_model_base.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for Azure Resource Manager/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.deviceregistry.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.deviceregistry.models.Origin - :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions - that are for internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.deviceregistry.models.ActionType - """ - - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - \"Microsoft.Compute/virtualMachines/write\", - \"Microsoft.Compute/virtualMachines/capture/action\".""" - is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) - """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and - \"false\" for Azure Resource Manager/control-plane operations.""" - display: Optional["_models.OperationDisplay"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Localized display information for this particular operation.""" - origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and - \"user,system\".""" - action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) - """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for - internal only APIs. \"Internal\"""" - - @overload - def __init__( - self, - *, - display: Optional["_models.OperationDisplay"] = 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 OperationDisplay(_model_base.Model): - """Localized display information for and operation. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - provider: Optional[str] = rest_field(visibility=["read"]) - """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring - Insights\" or \"Microsoft Compute\".""" - resource: Optional[str] = rest_field(visibility=["read"]) - """The localized friendly name of the resource type related to this operation. E.g. \"Virtual - Machines\" or \"Job Schedule Collections\".""" - operation: Optional[str] = rest_field(visibility=["read"]) - """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create - or Update Virtual Machine\", \"Restart Virtual Machine\".""" - description: Optional[str] = rest_field(visibility=["read"]) - """The short, localized friendly description of the operation; suitable for tool tips and detailed - views.""" - - -class OperationStatusResult(_model_base.Model): - """The current status of an async operation. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar id: Fully qualified ID for the async operation. - :vartype id: str - :ivar name: Name of the async operation. - :vartype name: str - :ivar status: Operation status. Required. - :vartype status: str - :ivar percent_complete: Percent of the operation that is complete. - :vartype percent_complete: float - :ivar start_time: The start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the operation. - :vartype end_time: ~datetime.datetime - :ivar operations: The operations list. - :vartype operations: list[~azure.mgmt.deviceregistry.models.OperationStatusResult] - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.deviceregistry.models.ErrorDetail - :ivar resource_id: Fully qualified ID of the resource against which the original async - operation was started. - :vartype resource_id: str - """ - - id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Fully qualified ID for the async operation.""" - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the async operation.""" - status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Operation status. Required.""" - percent_complete: Optional[float] = rest_field( - name="percentComplete", visibility=["read", "create", "update", "delete", "query"] - ) - """Percent of the operation that is complete.""" - start_time: Optional[datetime.datetime] = rest_field( - name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """The start time of the operation.""" - end_time: Optional[datetime.datetime] = rest_field( - name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """The end time of the operation.""" - operations: Optional[List["_models.OperationStatusResult"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The operations list.""" - error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """If present, details of the operation error.""" - resource_id: Optional[str] = rest_field(name="resourceId", visibility=["read"]) - """Fully qualified ID of the resource against which the original async operation was started.""" - - @overload - def __init__( - self, - *, - status: str, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - percent_complete: Optional[float] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - operations: Optional[List["_models.OperationStatusResult"]] = None, - error: Optional["_models.ErrorDetail"] = None, - ) -> 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 Schema(ProxyResource): - """Schema definition. +class ErrorAdditionalInfo(_model_base.Model): + """The resource management error additional info. Readonly 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". + :ivar type: The additional info type. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.SchemaProperties - """ - - properties: Optional["_models.SchemaProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The resource-specific properties for this resource.""" - - @overload - def __init__( - self, - *, - properties: Optional["_models.SchemaProperties"] = 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 SchemaProperties(_model_base.Model): - """Defines the schema properties. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - - - :ivar uuid: Globally unique, immutable, non-reusable id. - :vartype uuid: str - :ivar display_name: Human-readable display name. - :vartype display_name: str - :ivar description: Human-readable description of the schema. - :vartype description: str - :ivar format: Format of the schema. Required. Known values are: "JsonSchema/draft-07" and - "Delta/1.0". - :vartype format: str or ~azure.mgmt.deviceregistry.models.Format - :ivar schema_type: Type of the schema. Required. "MessageSchema" - :vartype schema_type: str or ~azure.mgmt.deviceregistry.models.SchemaType - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState - :ivar tags: Schema tags. - :vartype tags: dict[str, str] + :ivar info: The additional info. + :vartype info: any """ - uuid: Optional[str] = rest_field(visibility=["read"]) - """Globally unique, immutable, non-reusable id.""" - display_name: Optional[str] = rest_field( - name="displayName", visibility=["read", "create", "update", "delete", "query"] - ) - """Human-readable display name.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Human-readable description of the schema.""" - format: Union[str, "_models.Format"] = rest_field(visibility=["read", "create"]) - """Format of the schema. Required. Known values are: \"JsonSchema/draft-07\" and \"Delta/1.0\".""" - schema_type: Union[str, "_models.SchemaType"] = rest_field(name="schemaType", visibility=["read", "create"]) - """Type of the schema. Required. \"MessageSchema\"""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" - tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Schema tags.""" - - @overload - def __init__( - self, - *, - format: Union[str, "_models.Format"], - schema_type: Union[str, "_models.SchemaType"], - display_name: Optional[str] = None, - description: 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) + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" -class SchemaRegistry(TrackedResource): - """Schema registry definition. +class ErrorDetail(_model_base.Model): + """The error detail. Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.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 resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryProperties - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: ~azure.mgmt.deviceregistry.models.SystemAssignedServiceIdentity + :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.deviceregistry.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.deviceregistry.models.ErrorAdditionalInfo] """ - properties: Optional["_models.SchemaRegistryProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The resource-specific properties for this resource.""" - identity: Optional["_models.SystemAssignedServiceIdentity"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + 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 managed service identities assigned to this resource.""" - - @overload - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.SchemaRegistryProperties"] = None, - identity: Optional["_models.SystemAssignedServiceIdentity"] = 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 SchemaRegistryProperties(_model_base.Model): - """Defines the schema registry properties. + """The error additional info.""" - Readonly variables are only populated by the server, and will be ignored when sending a request. +class ErrorResponse(_model_base.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. - :ivar uuid: Globally unique, immutable, non-reusable id. - :vartype uuid: str - :ivar namespace: Schema registry namespace. Uniquely identifies a schema registry within a - tenant. Required. - :vartype namespace: str - :ivar display_name: Human-readable display name. - :vartype display_name: str - :ivar description: Human-readable description of the schema registry. - :vartype description: str - :ivar storage_account_container_url: The Storage Account's Container URL where schemas will be - stored. Required. - :vartype storage_account_container_url: str - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState + :ivar error: The error object. + :vartype error: ~azure.mgmt.deviceregistry.models.ErrorDetail """ - uuid: Optional[str] = rest_field(visibility=["read"]) - """Globally unique, immutable, non-reusable id.""" - namespace: str = rest_field(visibility=["read", "create"]) - """Schema registry namespace. Uniquely identifies a schema registry within a tenant. Required.""" - display_name: Optional[str] = rest_field( - name="displayName", visibility=["read", "create", "update", "delete", "query"] - ) - """Human-readable display name.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Human-readable description of the schema registry.""" - storage_account_container_url: str = rest_field(name="storageAccountContainerUrl", visibility=["read", "create"]) - """The Storage Account's Container URL where schemas will be stored. Required.""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" @overload def __init__( self, *, - namespace: str, - storage_account_container_url: str, - display_name: Optional[str] = None, - description: Optional[str] = None, + error: Optional["_models.ErrorDetail"] = None, ) -> None: ... @overload @@ -2557,35 +1226,44 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SchemaRegistryUpdate(_model_base.Model): - """The type used for update operations of the SchemaRegistry. +class EventBase(_model_base.Model): + """Defines the event properties. - :ivar identity: The managed service identities assigned to this resource. - :vartype identity: ~azure.mgmt.deviceregistry.models.SystemAssignedServiceIdentity - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryUpdateProperties + + :ivar name: The name of the event. Required. + :vartype name: str + :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that + a client can access the event on the asset. Required. + :vartype event_notifier: str + :ivar event_configuration: Stringified JSON that contains connector-specific configuration for + the event. For OPC UA, this could include configuration like, publishingInterval, + samplingInterval, and queueSize. + :vartype event_configuration: str + :ivar topic: Object that describes the topic information for the specific event. + :vartype topic: ~azure.mgmt.deviceregistry.models.Topic """ - identity: Optional["_models.SystemAssignedServiceIdentity"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The managed service identities assigned to this resource.""" - tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Resource tags.""" - properties: Optional["_models.SchemaRegistryUpdateProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the event. Required.""" + event_notifier: str = rest_field(name="eventNotifier", visibility=["read", "create", "update", "delete", "query"]) + """The address of the notifier of the event in the asset (e.g. URL) so that a client can access + the event on the asset. Required.""" + event_configuration: Optional[str] = rest_field( + name="eventConfiguration", visibility=["read", "create", "update", "delete", "query"] ) - """The resource-specific properties for this resource.""" + """Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this + could include configuration like, publishingInterval, samplingInterval, and queueSize.""" + topic: Optional["_models.Topic"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Object that describes the topic information for the specific event.""" @overload def __init__( self, *, - identity: Optional["_models.SystemAssignedServiceIdentity"] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.SchemaRegistryUpdateProperties"] = None, + name: str, + event_notifier: str, + event_configuration: Optional[str] = None, + topic: Optional["_models.Topic"] = None, ) -> None: ... @overload @@ -2599,28 +1277,41 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SchemaRegistryUpdateProperties(_model_base.Model): - """The updatable properties of the SchemaRegistry. +class Event(EventBase): + """Defines the event properties. + - :ivar display_name: Human-readable display name. - :vartype display_name: str - :ivar description: Human-readable description of the schema registry. - :vartype description: str + :ivar name: The name of the event. Required. + :vartype name: str + :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that + a client can access the event on the asset. Required. + :vartype event_notifier: str + :ivar event_configuration: Stringified JSON that contains connector-specific configuration for + the event. For OPC UA, this could include configuration like, publishingInterval, + samplingInterval, and queueSize. + :vartype event_configuration: str + :ivar topic: Object that describes the topic information for the specific event. + :vartype topic: ~azure.mgmt.deviceregistry.models.Topic + :ivar observability_mode: An indication of how the event should be mapped to OpenTelemetry. + Known values are: "None" and "Log". + :vartype observability_mode: str or ~azure.mgmt.deviceregistry.models.EventObservabilityMode """ - display_name: Optional[str] = rest_field( - name="displayName", visibility=["read", "create", "update", "delete", "query"] + observability_mode: Optional[Union[str, "_models.EventObservabilityMode"]] = rest_field( + name="observabilityMode", visibility=["read", "create", "update", "delete", "query"] ) - """Human-readable display name.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Human-readable description of the schema registry.""" + """An indication of how the event should be mapped to OpenTelemetry. Known values are: \"None\" + and \"Log\".""" @overload def __init__( self, *, - display_name: Optional[str] = None, - description: Optional[str] = None, + name: str, + event_notifier: str, + event_configuration: Optional[str] = None, + topic: Optional["_models.Topic"] = None, + observability_mode: Optional[Union[str, "_models.EventObservabilityMode"]] = None, ) -> None: ... @overload @@ -2634,36 +1325,27 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SchemaVersion(ProxyResource): - """Schema version's definition. +class ExtendedLocation(_model_base.Model): + """The extended location. - Readonly 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". + :ivar type: The extended location type. Required. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.deviceregistry.models.SystemData - :ivar properties: The resource-specific properties for this resource. - :vartype properties: ~azure.mgmt.deviceregistry.models.SchemaVersionProperties + :ivar name: The extended location name. Required. + :vartype name: str """ - properties: Optional["_models.SchemaVersionProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The resource-specific properties for this resource.""" + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The extended location type. Required.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The extended location name. Required.""" @overload def __init__( self, *, - properties: Optional["_models.SchemaVersionProperties"] = None, + type: str, + name: str, ) -> None: ... @overload @@ -2677,45 +1359,74 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SchemaVersionProperties(_model_base.Model): - """Defines the schema version properties. +class MessageSchemaReference(_model_base.Model): + """Defines the message schema reference properties. Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar uuid: Globally unique, immutable, non-reusable id. - :vartype uuid: str - :ivar description: Human-readable description of the schema. - :vartype description: str - :ivar schema_content: Schema content. Required. - :vartype schema_content: str - :ivar hash: Hash of the schema content. - :vartype hash: str - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", - "Failed", "Canceled", "Accepted", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState + :ivar schema_registry_namespace: The message schema registry namespace. Required. + :vartype schema_registry_namespace: str + :ivar schema_name: The message schema name. Required. + :vartype schema_name: str + :ivar schema_version: The message schema version. Required. + :vartype schema_version: str """ - uuid: Optional[str] = rest_field(visibility=["read"]) - """Globally unique, immutable, non-reusable id.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Human-readable description of the schema.""" - schema_content: str = rest_field(name="schemaContent", visibility=["read", "create"]) - """Schema content. Required.""" - hash: Optional[str] = rest_field(visibility=["read"]) - """Hash of the schema content.""" - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read"] + schema_registry_namespace: str = rest_field(name="schemaRegistryNamespace", visibility=["read"]) + """The message schema registry namespace. Required.""" + schema_name: str = rest_field(name="schemaName", visibility=["read"]) + """The message schema name. Required.""" + schema_version: str = rest_field(name="schemaVersion", visibility=["read"]) + """The message schema version. Required.""" + + +class Operation(_model_base.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.deviceregistry.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.deviceregistry.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.deviceregistry.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Provisioning state of the resource. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", - \"Accepted\", and \"Deleting\".""" + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" @overload def __init__( self, *, - schema_content: str, - description: Optional[str] = None, + display: Optional["_models.OperationDisplay"] = None, ) -> None: ... @overload @@ -2729,40 +1440,105 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SystemAssignedServiceIdentity(_model_base.Model): - """Managed service identity (either system assigned, or none). +class OperationDisplay(_model_base.Model): + """Localized display information for and operation. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class OperationStatusResult(_model_base.Model): + """The current status of an async operation. Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: The type of managed identity assigned to this resource. Required. Known values are: - "None" and "SystemAssigned". - :vartype type: str or ~azure.mgmt.deviceregistry.models.SystemAssignedServiceIdentityType + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: list[~azure.mgmt.deviceregistry.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.deviceregistry.models.ErrorDetail + :ivar resource_id: Fully qualified ID of the resource against which the original async + operation was started. + :vartype resource_id: str """ - principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) - """The service principal ID of the system assigned 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 of the system assigned identity. This property will only be provided for a system - assigned identity.""" - type: Union[str, "_models.SystemAssignedServiceIdentityType"] = rest_field( + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Fully qualified ID for the async operation.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the async operation.""" + status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation status. Required.""" + percent_complete: Optional[float] = rest_field( + name="percentComplete", visibility=["read", "create", "update", "delete", "query"] + ) + """Percent of the operation that is complete.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The start time of the operation.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end time of the operation.""" + operations: Optional[List["_models.OperationStatusResult"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The type of managed identity assigned to this resource. Required. Known values are: \"None\" - and \"SystemAssigned\".""" + """The operations list.""" + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """If present, details of the operation error.""" + resource_id: Optional[str] = rest_field(name="resourceId", visibility=["read"]) + """Fully qualified ID of the resource against which the original async operation was started.""" @overload def __init__( self, *, - type: Union[str, "_models.SystemAssignedServiceIdentityType"], + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetail"] = None, ) -> None: ... @overload diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/__init__.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/__init__.py index 04984dadf2b..763af1696fc 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/__init__.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/__init__.py @@ -17,11 +17,6 @@ from ._operations import AssetsOperations # type: ignore from ._operations import AssetEndpointProfilesOperations # type: ignore from ._operations import BillingContainersOperations # type: ignore -from ._operations import DiscoveredAssetsOperations # type: ignore -from ._operations import DiscoveredAssetEndpointProfilesOperations # type: ignore -from ._operations import SchemaRegistriesOperations # type: ignore -from ._operations import SchemasOperations # type: ignore -from ._operations import SchemaVersionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -33,11 +28,6 @@ "AssetsOperations", "AssetEndpointProfilesOperations", "BillingContainersOperations", - "DiscoveredAssetsOperations", - "DiscoveredAssetEndpointProfilesOperations", - "SchemaRegistriesOperations", - "SchemasOperations", - "SchemaVersionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py index 0dd4c41b1ac..2519b9c6720 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py @@ -54,7 +54,7 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +75,7 @@ def build_operation_status_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +103,7 @@ def build_assets_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +132,7 @@ def build_assets_create_or_replace_request( _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", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +163,7 @@ def build_assets_update_request( _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", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -193,7 +193,7 @@ def build_assets_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -221,7 +221,7 @@ def build_assets_list_by_resource_group_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -250,7 +250,7 @@ def build_assets_list_by_subscription_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -276,7 +276,7 @@ def build_asset_endpoint_profiles_get_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -305,7 +305,7 @@ def build_asset_endpoint_profiles_create_or_replace_request( # pylint: disable= _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", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -336,7 +336,7 @@ def build_asset_endpoint_profiles_update_request( # pylint: disable=name-too-lo _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", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -366,7 +366,7 @@ def build_asset_endpoint_profiles_delete_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -394,7 +394,7 @@ def build_asset_endpoint_profiles_list_by_resource_group_request( # pylint: dis _headers = case_insensitive_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-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -421,7 +421,7 @@ def build_asset_endpoint_profiles_list_by_subscription_request( # pylint: disab _headers = case_insensitive_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-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -447,7 +447,7 @@ def build_billing_containers_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -474,7 +474,7 @@ def build_billing_containers_list_by_subscription_request( # pylint: disable=na _headers = case_insensitive_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-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -494,4599 +494,38 @@ def build_billing_containers_list_by_subscription_request( # pylint: disable=na return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_discovered_assets_get_request( - resource_group_name: str, discovered_asset_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetName": _SERIALIZER.url("discovered_asset_name", discovered_asset_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_discovered_assets_create_or_replace_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetName": _SERIALIZER.url("discovered_asset_name", discovered_asset_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_discovered_assets_update_request( - resource_group_name: str, discovered_asset_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetName": _SERIALIZER.url("discovered_asset_name", discovered_asset_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_discovered_assets_delete_request( - resource_group_name: str, discovered_asset_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetName": _SERIALIZER.url("discovered_asset_name", discovered_asset_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) - - -def build_discovered_assets_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets" - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_assets_list_by_subscription_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssets" - 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_discovered_asset_endpoint_profiles_get_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_endpoint_profile_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetEndpointProfileName": _SERIALIZER.url( - "discovered_asset_endpoint_profile_name", discovered_asset_endpoint_profile_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_discovered_asset_endpoint_profiles_create_or_replace_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_endpoint_profile_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetEndpointProfileName": _SERIALIZER.url( - "discovered_asset_endpoint_profile_name", discovered_asset_endpoint_profile_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_discovered_asset_endpoint_profiles_update_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_endpoint_profile_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetEndpointProfileName": _SERIALIZER.url( - "discovered_asset_endpoint_profile_name", discovered_asset_endpoint_profile_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_discovered_asset_endpoint_profiles_delete_request( # pylint: disable=name-too-long - resource_group_name: str, discovered_asset_endpoint_profile_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "discoveredAssetEndpointProfileName": _SERIALIZER.url( - "discovered_asset_endpoint_profile_name", discovered_asset_endpoint_profile_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) - - -def build_discovered_asset_endpoint_profiles_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles" - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_discovered_asset_endpoint_profiles_list_by_subscription_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles" - 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_schema_registries_get_request( - resource_group_name: str, schema_registry_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_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_schema_registries_create_or_replace_request( # pylint: disable=name-too-long - resource_group_name: str, schema_registry_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_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_schema_registries_update_request( - resource_group_name: str, schema_registry_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_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_schema_registries_delete_request( - resource_group_name: str, schema_registry_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_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) - - -def build_schema_registries_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries" - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schema_registries_list_by_subscription_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/schemaRegistries" - 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_schemas_get_request( - resource_group_name: str, schema_registry_name: str, schema_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_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_schemas_create_or_replace_request( - resource_group_name: str, schema_registry_name: str, schema_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_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_schemas_delete_request( - resource_group_name: str, schema_registry_name: str, schema_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_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) - - -def build_schemas_list_by_schema_registry_request( # pylint: disable=name-too-long - resource_group_name: str, schema_registry_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_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_schema_versions_get_request( - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - "schemaVersionName": _SERIALIZER.url("schema_version_name", schema_version_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_schema_versions_create_or_replace_request( # pylint: disable=name-too-long - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - "schemaVersionName": _SERIALIZER.url("schema_version_name", schema_version_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_schema_versions_delete_request( - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_name, "str"), - "schemaVersionName": _SERIALIZER.url("schema_version_name", schema_version_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) - - -def build_schema_versions_list_by_schema_request( # pylint: disable=name-too-long - resource_group_name: str, schema_registry_name: str, schema_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-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "schemaRegistryName": _SERIALIZER.url("schema_registry_name", schema_registry_name, "str"), - "schemaName": _SERIALIZER.url("schema_name", schema_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 Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`operations` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of Operation - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Operation]] = 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( - 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.Operation], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class OperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`operation_status` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationStatusResult: - """Returns the current status of an async operation. - - :param location: The location name. Required. - :type location: str - :param operation_id: The ID of an ongoing async operation. Required. - :type operation_id: str - :return: OperationStatusResult. The OperationStatusResult is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.OperationStatusResult - :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.OperationStatusResult] = kwargs.pop("cls", None) - - _request = build_operation_status_get_request( - location=location, - operation_id=operation_id, - 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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.OperationStatusResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class AssetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`assets` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> _models.Asset: - """Get a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :return: Asset. The Asset is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Asset - :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.Asset] = kwargs.pop("cls", None) - - _request = build_assets_get_request( - resource_group_name=resource_group_name, - asset_name=asset_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Asset, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _create_or_replace_initial( - self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, 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(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_assets_create_or_replace_request( - resource_group_name=resource_group_name, - asset_name=asset_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.json()) - 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_or_replace( - self, - resource_group_name: str, - asset_name: str, - resource: _models.Asset, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Create a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.Asset - :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 Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Create a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Create a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_create_or_replace( - self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Create a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param resource: Resource create parameters. Is one of the following types: Asset, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.Asset or JSON or IO[bytes] - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :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.Asset] = 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_replace_initial( - resource_group_name=resource_group_name, - asset_name=asset_name, - resource=resource, - 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.Asset, 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.Asset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Asset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _update_initial( - self, - resource_group_name: str, - asset_name: str, - properties: Union[_models.AssetUpdate, 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(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_assets_update_request( - resource_group_name=resource_group_name, - asset_name=asset_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, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - 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 - - @overload - def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: _models.AssetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Update a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate - :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 Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Update a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Update a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_update( - self, - resource_group_name: str, - asset_name: str, - properties: Union[_models.AssetUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Asset]: - """Update a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_name: str - :param properties: The resource properties to be updated. Is one of the following types: - AssetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns Asset. The Asset is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] - :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.Asset] = 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, - asset_name=asset_name, - properties=properties, - 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.Asset, 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.Asset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Asset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _delete_initial(self, resource_group_name: str, asset_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_assets_delete_request( - resource_group_name=resource_group_name, - asset_name=asset_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 [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.json()) - 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_delete(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a Asset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_name: Asset name parameter. Required. - :type asset_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, - asset_name=asset_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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Asset"]: - """List Asset resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of Asset - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Asset]] = 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_assets_list_by_resource_group_request( - resource_group_name=resource_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) - - 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.Asset], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Asset"]: - """List Asset resources by subscription ID. - - :return: An iterator like instance of Asset - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Asset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Asset]] = 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_assets_list_by_subscription_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.Asset], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class AssetEndpointProfilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`asset_endpoint_profiles` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def get( - self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any - ) -> _models.AssetEndpointProfile: - """Get a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :return: AssetEndpointProfile. The AssetEndpointProfile is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile - :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.AssetEndpointProfile] = kwargs.pop("cls", None) - - _request = build_asset_endpoint_profiles_get_request( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.AssetEndpointProfile, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _create_or_replace_initial( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: Union[_models.AssetEndpointProfile, 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(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_asset_endpoint_profiles_create_or_replace_request( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_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.json()) - 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_or_replace( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: _models.AssetEndpointProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Create a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile - :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 AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Create a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Create a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_create_or_replace( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - resource: Union[_models.AssetEndpointProfile, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Create a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param resource: Resource create parameters. Is one of the following types: - AssetEndpointProfile, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile or JSON or IO[bytes] - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :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.AssetEndpointProfile] = 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_replace_initial( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_name, - resource=resource, - 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.AssetEndpointProfile, 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.AssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _update_initial( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: Union[_models.AssetEndpointProfileUpdate, 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(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_asset_endpoint_profiles_update_request( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_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, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - 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 - - @overload - def begin_update( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: _models.AssetEndpointProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Update a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate - :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 AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Update a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Update a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_update( - self, - resource_group_name: str, - asset_endpoint_profile_name: str, - properties: Union[_models.AssetEndpointProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AssetEndpointProfile]: - """Update a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Is one of the following types: - AssetEndpointProfileUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate or JSON or - IO[bytes] - :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :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.AssetEndpointProfile] = 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, - asset_endpoint_profile_name=asset_endpoint_profile_name, - properties=properties, - 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.AssetEndpointProfile, 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.AssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def _delete_initial( - self, resource_group_name: str, asset_endpoint_profile_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_asset_endpoint_profiles_delete_request( - resource_group_name=resource_group_name, - asset_endpoint_profile_name=asset_endpoint_profile_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 [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.json()) - 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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def begin_delete( - self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a AssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. - :type asset_endpoint_profile_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, - asset_endpoint_profile_name=asset_endpoint_profile_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 - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.AssetEndpointProfile"]: - """List AssetEndpointProfile resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of AssetEndpointProfile - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.AssetEndpointProfile]] = 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_asset_endpoint_profiles_list_by_resource_group_request( - resource_group_name=resource_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) - - 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.AssetEndpointProfile], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AssetEndpointProfile"]: - """List AssetEndpointProfile resources by subscription ID. - - :return: An iterator like instance of AssetEndpointProfile - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.AssetEndpointProfile]] = 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_asset_endpoint_profiles_list_by_subscription_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.AssetEndpointProfile], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class BillingContainersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`billing_containers` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "billing_container_name", "accept"] - }, - ) - def get(self, billing_container_name: str, **kwargs: Any) -> _models.BillingContainer: - """Get a BillingContainer. - - :param billing_container_name: Name of the billing container. Required. - :type billing_container_name: str - :return: BillingContainer. The BillingContainer is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.BillingContainer - :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.BillingContainer] = kwargs.pop("cls", None) - - _request = build_billing_containers_get_request( - billing_container_name=billing_container_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.BillingContainer, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BillingContainer"]: - """List BillingContainer resources by subscription ID. - - :return: An iterator like instance of BillingContainer - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.BillingContainer] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.BillingContainer]] = 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_billing_containers_list_by_subscription_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.BillingContainer], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class DiscoveredAssetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`discovered_assets` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - def get(self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any) -> _models.DiscoveredAsset: - """Get a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :return: DiscoveredAsset. The DiscoveredAsset is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.DiscoveredAsset - :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.DiscoveredAsset] = kwargs.pop("cls", None) - - _request = build_discovered_assets_get_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DiscoveredAsset, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - def _create_or_replace_initial( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: Union[_models.DiscoveredAsset, 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(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_assets_create_or_replace_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_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.json()) - 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_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: _models.DiscoveredAsset, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAsset - :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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_name: str, - resource: Union[_models.DiscoveredAsset, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Create a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param resource: Resource create parameters. Is one of the following types: DiscoveredAsset, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAsset or JSON or IO[bytes] - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :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.DiscoveredAsset] = 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_replace_initial( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_name, - resource=resource, - 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.DiscoveredAsset, 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.DiscoveredAsset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiscoveredAsset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - def _update_initial( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: Union[_models.DiscoveredAssetUpdate, 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(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_assets_update_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_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, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - 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 - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: _models.DiscoveredAssetUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdate - :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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "content_type", - "accept", - ] - }, - ) - def begin_update( - self, - resource_group_name: str, - discovered_asset_name: str, - properties: Union[_models.DiscoveredAssetUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAsset]: - """Update a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DiscoveredAssetUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns DiscoveredAsset. The DiscoveredAsset is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :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.DiscoveredAsset] = 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, - discovered_asset_name=discovered_asset_name, - properties=properties, - 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.DiscoveredAsset, 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.DiscoveredAsset].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiscoveredAsset]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - def _delete_initial(self, resource_group_name: str, discovered_asset_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_discovered_assets_delete_request( - resource_group_name=resource_group_name, - discovered_asset_name=discovered_asset_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 [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.json()) - 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_name", - "accept", - ] - }, - ) - def begin_delete(self, resource_group_name: str, discovered_asset_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a DiscoveredAsset. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_name: Discovered Asset name parameter. Required. - :type discovered_asset_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, - discovered_asset_name=discovered_asset_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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, - ) - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DiscoveredAsset"]: - """List DiscoveredAsset resources by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiscoveredAsset - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAsset]] = 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_discovered_assets_list_by_resource_group_request( - resource_group_name=resource_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) - - 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.DiscoveredAsset], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, - ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DiscoveredAsset"]: - """List DiscoveredAsset resources by subscription ID. - - :return: An iterator like instance of DiscoveredAsset - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAsset] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAsset]] = 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_discovered_assets_list_by_subscription_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.DiscoveredAsset], deserialized["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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class DiscoveredAssetEndpointProfilesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`discovered_asset_endpoint_profiles` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DeviceRegistryMgmtClientConfiguration = 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - def get( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> _models.DiscoveredAssetEndpointProfile: - """Get a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :return: DiscoveredAssetEndpointProfile. The DiscoveredAssetEndpointProfile is compatible with - MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile - :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.DiscoveredAssetEndpointProfile] = kwargs.pop("cls", None) - - _request = build_discovered_asset_endpoint_profiles_get_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DiscoveredAssetEndpointProfile, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - def _create_or_replace_initial( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: Union[_models.DiscoveredAssetEndpointProfile, 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(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_asset_endpoint_profiles_create_or_replace_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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.json()) - 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_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: _models.DiscoveredAssetEndpointProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile - :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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: 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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - def begin_create_or_replace( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - resource: Union[_models.DiscoveredAssetEndpointProfile, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Create a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param resource: Resource create parameters. Is one of the following types: - DiscoveredAssetEndpointProfile, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile or JSON or - IO[bytes] - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :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.DiscoveredAssetEndpointProfile] = 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_replace_initial( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - resource=resource, - 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.DiscoveredAssetEndpointProfile, 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.DiscoveredAssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiscoveredAssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - def _update_initial( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: Union[_models.DiscoveredAssetEndpointProfileUpdate, 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(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_discovered_asset_endpoint_profiles_update_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - 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 - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: _models.DiscoveredAssetEndpointProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate - :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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Required. - :type properties: 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 DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "content_type", - "accept", - ] - }, - ) - def begin_update( - self, - resource_group_name: str, - discovered_asset_endpoint_profile_name: str, - properties: Union[_models.DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiscoveredAssetEndpointProfile]: - """Update a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DiscoveredAssetEndpointProfileUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate or - JSON or IO[bytes] - :return: An instance of LROPoller that returns DiscoveredAssetEndpointProfile. The - DiscoveredAssetEndpointProfile is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] - :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.DiscoveredAssetEndpointProfile] = 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, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_name, - properties=properties, - 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.DiscoveredAssetEndpointProfile, 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.DiscoveredAssetEndpointProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DiscoveredAssetEndpointProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - def _delete_initial( - self, resource_group_name: str, discovered_asset_endpoint_profile_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_discovered_asset_endpoint_profiles_delete_request( - resource_group_name=resource_group_name, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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 [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.json()) - 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 - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "discovered_asset_endpoint_profile_name", - "accept", - ] - }, - ) - def begin_delete( - self, resource_group_name: str, discovered_asset_endpoint_profile_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a DiscoveredAssetEndpointProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param discovered_asset_endpoint_profile_name: Discovered Asset Endpoint Profile name - parameter. Required. - :type discovered_asset_endpoint_profile_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, - discovered_asset_endpoint_profile_name=discovered_asset_endpoint_profile_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 +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s + :attr:`operations` attribute. + """ - 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 + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = 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 @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.DiscoveredAssetEndpointProfile"]: - """List DiscoveredAssetEndpointProfile resources by resource group. + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of DiscoveredAssetEndpointProfile - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DiscoveredAssetEndpointProfile]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5099,9 +538,7 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - _request = build_discovered_asset_endpoint_profiles_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, + _request = build_operations_list_request( api_version=self._config.api_version, headers=_headers, params=_params, @@ -5137,7 +574,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAssetEndpointProfile], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -5160,24 +597,39 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s + :attr:`operation_status` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = 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 @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DiscoveredAssetEndpointProfile"]: - """List DiscoveredAssetEndpointProfile resources by subscription ID. + def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationStatusResult: + """Returns the current status of an async operation. - :return: An iterator like instance of DiscoveredAssetEndpointProfile - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.DiscoveredAssetEndpointProfile] + :param location: The location name. Required. + :type location: str + :param operation_id: The ID of an ongoing async operation. Required. + :type operation_id: str + :return: OperationStatusResult. The OperationStatusResult is compatible with MutableMapping + :rtype: ~azure.mgmt.deviceregistry.models.OperationStatusResult :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DiscoveredAssetEndpointProfile]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5186,78 +638,60 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DiscoveredAss } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_discovered_asset_endpoint_profiles_list_by_subscription_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) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - return _request + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DiscoveredAssetEndpointProfile], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _request = build_operation_status_get_request( + location=location, + operation_id=operation_id, + 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) - def get_next(next_link=None): - _request = prepare_request(next_link) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response = pipeline_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return pipeline_response + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationStatusResult, response.json()) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore -class SchemaRegistriesOperations: +class AssetsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`schema_registries` attribute. + :attr:`assets` attribute. """ def __init__(self, *args, **kwargs): @@ -5269,28 +703,18 @@ def __init__(self, *args, **kwargs): @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any) -> _models.SchemaRegistry: - """Get a SchemaRegistry. + def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> _models.Asset: + """Get a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :return: SchemaRegistry. The SchemaRegistry is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaRegistry + :param asset_name: Asset name parameter. Required. + :type asset_name: str + :return: Asset. The Asset is compatible with MutableMapping + :rtype: ~azure.mgmt.deviceregistry.models.Asset :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5304,11 +728,11 @@ def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SchemaRegistry] = kwargs.pop("cls", None) + cls: ClsType[_models.Asset] = kwargs.pop("cls", None) - _request = build_schema_registries_get_request( + _request = build_assets_get_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5339,7 +763,7 @@ def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SchemaRegistry, response.json()) + deserialized = _deserialize(_models.Asset, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5347,25 +771,10 @@ def get(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any return deserialized # type: ignore @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) def _create_or_replace_initial( - self, - resource_group_name: str, - schema_registry_name: str, - resource: Union[_models.SchemaRegistry, JSON, IO[bytes]], - **kwargs: Any + self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5388,9 +797,9 @@ def _create_or_replace_initial( else: _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_schema_registries_create_or_replace_request( + _request = build_assets_create_or_replace_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -5437,27 +846,27 @@ def _create_or_replace_initial( def begin_create_or_replace( self, resource_group_name: str, - schema_registry_name: str, - resource: _models.SchemaRegistry, + asset_name: str, + resource: _models.Asset, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Create a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaRegistry + :type resource: ~azure.mgmt.deviceregistry.models.Asset :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 SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5465,27 +874,27 @@ def begin_create_or_replace( def begin_create_or_replace( self, resource_group_name: str, - schema_registry_name: str, + asset_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Create a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param resource: Resource create parameters. Required. :type resource: 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 SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5493,79 +902,64 @@ def begin_create_or_replace( def begin_create_or_replace( self, resource_group_name: str, - schema_registry_name: str, + asset_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Create a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param resource: Resource create parameters. Required. :type resource: 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 SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) def begin_create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - resource: Union[_models.SchemaRegistry, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Create a SchemaRegistry. + self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.Asset]: + """Create a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param resource: Resource create parameters. Is one of the following types: SchemaRegistry, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaRegistry or JSON or IO[bytes] - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :param asset_name: Asset name parameter. Required. + :type asset_name: str + :param resource: Resource create parameters. Is one of the following types: Asset, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.deviceregistry.models.Asset or JSON or IO[bytes] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :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.SchemaRegistry] = kwargs.pop("cls", None) + cls: ClsType[_models.Asset] = 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_replace_initial( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, resource=resource, content_type=content_type, cls=lambda x, y, z: x, @@ -5578,7 +972,7 @@ def begin_create_or_replace( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SchemaRegistry, response.json()) + deserialized = _deserialize(_models.Asset, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5596,35 +990,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SchemaRegistry].from_continuation_token( + return LROPoller[_models.Asset].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.SchemaRegistry]( + return LROPoller[_models.Asset]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) def _update_initial( self, resource_group_name: str, - schema_registry_name: str, - properties: Union[_models.SchemaRegistryUpdate, JSON, IO[bytes]], + asset_name: str, + properties: Union[_models.AssetUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -5648,9 +1031,9 @@ def _update_initial( else: _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_schema_registries_update_request( + _request = build_assets_update_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -5695,27 +1078,27 @@ def _update_initial( def begin_update( self, resource_group_name: str, - schema_registry_name: str, - properties: _models.SchemaRegistryUpdate, + asset_name: str, + properties: _models.AssetUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Update a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryUpdate + :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate :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 SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5723,27 +1106,27 @@ def begin_update( def begin_update( self, resource_group_name: str, - schema_registry_name: str, + asset_name: str, properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Update a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param properties: The resource properties to be updated. Required. :type properties: 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 SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -5751,79 +1134,68 @@ def begin_update( def begin_update( self, resource_group_name: str, - schema_registry_name: str, + asset_name: str, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Update a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param properties: The resource properties to be updated. Required. :type properties: 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 SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) def begin_update( self, resource_group_name: str, - schema_registry_name: str, - properties: Union[_models.SchemaRegistryUpdate, JSON, IO[bytes]], + asset_name: str, + properties: Union[_models.AssetUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.SchemaRegistry]: - """Update a SchemaRegistry. + ) -> LROPoller[_models.Asset]: + """Update a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :param properties: The resource properties to be updated. Is one of the following types: - SchemaRegistryUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.deviceregistry.models.SchemaRegistryUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns SchemaRegistry. The SchemaRegistry is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.SchemaRegistry] + AssetUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.deviceregistry.models.AssetUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns Asset. The Asset is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.Asset] :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.SchemaRegistry] = kwargs.pop("cls", None) + cls: ClsType[_models.Asset] = 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, - schema_registry_name=schema_registry_name, + asset_name=asset_name, properties=properties, content_type=content_type, cls=lambda x, y, z: x, @@ -5836,7 +1208,7 @@ def begin_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SchemaRegistry, response.json()) + deserialized = _deserialize(_models.Asset, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5854,30 +1226,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SchemaRegistry].from_continuation_token( + return LROPoller[_models.Asset].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.SchemaRegistry]( + return LROPoller[_models.Asset]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def _delete_initial(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any) -> Iterator[bytes]: + def _delete_initial(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5891,9 +1253,9 @@ def _delete_initial(self, resource_group_name: str, schema_registry_name: str, * cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_schema_registries_delete_request( + _request = build_assets_delete_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5934,26 +1296,16 @@ def _delete_initial(self, resource_group_name: str, schema_registry_name: str, * @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def begin_delete(self, resource_group_name: str, schema_registry_name: str, **kwargs: Any) -> LROPoller[None]: - """Delete a SchemaRegistry. + def begin_delete(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a Asset. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str + :param asset_name: Asset name parameter. Required. + :type asset_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -5968,7 +1320,7 @@ def begin_delete(self, resource_group_name: str, schema_registry_name: str, **kw if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + asset_name=asset_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -6004,25 +1356,110 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "resource_group_name", "accept"] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Asset"]: + """List Asset resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Asset + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Asset] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Asset]] = 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_assets_list_by_resource_group_request( + resource_group_name=resource_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) + + 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.Asset], deserialized["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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SchemaRegistry"]: - """List SchemaRegistry resources by resource group. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Asset"]: + """List Asset resources by subscription ID. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of SchemaRegistry - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :return: An iterator like instance of Asset + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Asset] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SchemaRegistry]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Asset]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6035,8 +1472,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - _request = build_schema_registries_list_by_resource_group_request( - resource_group_name=resource_group_name, + _request = build_assets_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6073,7 +1509,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SchemaRegistry], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Asset], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6094,145 +1530,345 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + return ItemPaged(get_next, extract_data) + + +class AssetEndpointProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s + :attr:`asset_endpoint_profiles` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeviceRegistryMgmtClientConfiguration = 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 + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def get( + self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any + ) -> _models.AssetEndpointProfile: + """Get a AssetEndpointProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :return: AssetEndpointProfile. The AssetEndpointProfile is compatible with MutableMapping + :rtype: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile + :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.AssetEndpointProfile] = kwargs.pop("cls", None) + + _request = build_asset_endpoint_profiles_get_request( + resource_group_name=resource_group_name, + asset_endpoint_profile_name=asset_endpoint_profile_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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AssetEndpointProfile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def _create_or_replace_initial( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: Union[_models.AssetEndpointProfile, 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(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_asset_endpoint_profiles_create_or_replace_request( + resource_group_name=resource_group_name, + asset_endpoint_profile_name=asset_endpoint_profile_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.json()) + 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_or_replace( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: _models.AssetEndpointProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssetEndpointProfile]: + """Create a AssetEndpointProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile + :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 AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_replace( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssetEndpointProfile]: + """Create a AssetEndpointProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_replace( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AssetEndpointProfile]: + """Create a AssetEndpointProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: 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 AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SchemaRegistry"]: - """List SchemaRegistry resources by subscription ID. + def begin_create_or_replace( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + resource: Union[_models.AssetEndpointProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AssetEndpointProfile]: + """Create a AssetEndpointProfile. - :return: An iterator like instance of SchemaRegistry - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.SchemaRegistry] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param resource: Resource create parameters. Is one of the following types: + AssetEndpointProfile, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.deviceregistry.models.AssetEndpointProfile or JSON or IO[bytes] + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SchemaRegistry]] = 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_schema_registries_list_by_subscription_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 + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AssetEndpointProfile] = 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_replace_initial( + resource_group_name=resource_group_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, + resource=resource, + 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 extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SchemaRegistry], deserialized["value"]) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AssetEndpointProfile, response.json()) if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - def get_next(next_link=None): - _request = prepare_request(next_link) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) ) - response = pipeline_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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class SchemasOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`schemas` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DeviceRegistryMgmtClientConfiguration = 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") + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AssetEndpointProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AssetEndpointProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def get( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> _models.Schema: - """Get a Schema. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _update_initial( + self, + resource_group_name: str, + asset_endpoint_profile_name: str, + properties: Union[_models.AssetEndpointProfileUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6241,17 +1877,26 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Schema] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_schemas_get_request( + _request = build_asset_endpoint_profiles_update_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6260,163 +1905,203 @@ def get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _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]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Schema, response.json()) + 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, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def create_or_replace( + def begin_update( self, resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: _models.Schema, + asset_endpoint_profile_name: str, + properties: _models.AssetEndpointProfileUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schema: - """Create a Schema. + ) -> LROPoller[_models.AssetEndpointProfile]: + """Update a AssetEndpointProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.Schema + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_replace( + def begin_update( self, resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: JSON, + asset_endpoint_profile_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schema: - """Create a Schema. + ) -> LROPoller[_models.AssetEndpointProfile]: + """Update a AssetEndpointProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_replace( + def begin_update( self, resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: IO[bytes], + asset_endpoint_profile_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schema: - """Create a Schema. + ) -> LROPoller[_models.AssetEndpointProfile]: + """Update a AssetEndpointProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "content_type", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def create_or_replace( + def begin_update( self, resource_group_name: str, - schema_registry_name: str, - schema_name: str, - resource: Union[_models.Schema, JSON, IO[bytes]], + asset_endpoint_profile_name: str, + properties: Union[_models.AssetEndpointProfileUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Schema: - """Create a Schema. + ) -> LROPoller[_models.AssetEndpointProfile]: + """Update a AssetEndpointProfile. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param resource: Resource create parameters. Is one of the following types: Schema, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.Schema or JSON or IO[bytes] - :return: Schema. The Schema is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.Schema + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_name: str + :param properties: The resource properties to be updated. Is one of the following types: + AssetEndpointProfileUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.deviceregistry.models.AssetEndpointProfileUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns AssetEndpointProfile. The AssetEndpointProfile + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :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.AssetEndpointProfile] = 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, + asset_endpoint_profile_name=asset_endpoint_profile_name, + properties=properties, + 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.AssetEndpointProfile, 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.AssetEndpointProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AssetEndpointProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def _delete_initial( + self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6425,27 +2110,16 @@ def create_or_replace( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = 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.Schema] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_schemas_create_or_replace_request( + _request = build_asset_endpoint_profiles_delete_request( resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, + asset_endpoint_profile_name=asset_endpoint_profile_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6454,64 +2128,117 @@ def create_or_replace( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = kwargs.pop("stream", False) + _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]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Schema, response.json()) + 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, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, + ) + def begin_delete( + self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a AssetEndpointProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param asset_endpoint_profile_name: Asset Endpoint Profile name parameter. Required. + :type asset_endpoint_profile_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, + asset_endpoint_profile_name=asset_endpoint_profile_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 + @api_version_validation( + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> None: - """Delete a Schema. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.AssetEndpointProfile"]: + """List AssetEndpointProfile resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: None - :rtype: None + :return: An iterator like instance of AssetEndpointProfile + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AssetEndpointProfile]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6520,72 +2247,85 @@ def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[None] = kwargs.pop("cls", None) + _request = build_asset_endpoint_profiles_list_by_resource_group_request( + resource_group_name=resource_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) - _request = build_schemas_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_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.AssetEndpointProfile], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def get_next(next_link=None): + _request = prepare_request(next_link) - response = pipeline_response.http_response + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url"]}, ) - def list_by_schema_registry( - self, resource_group_name: str, schema_registry_name: str, **kwargs: Any - ) -> Iterable["_models.Schema"]: - """List Schema resources by SchemaRegistry. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AssetEndpointProfile"]: + """List AssetEndpointProfile resources by subscription ID. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :return: An iterator like instance of Schema - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.Schema] + :return: An iterator like instance of AssetEndpointProfile + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.AssetEndpointProfile] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Schema]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.AssetEndpointProfile]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6598,9 +2338,7 @@ def list_by_schema_registry( def prepare_request(next_link=None): if not next_link: - _request = build_schemas_list_by_schema_registry_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, + _request = build_asset_endpoint_profiles_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6637,7 +2375,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Schema], deserialized["value"]) + list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6661,14 +2399,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class SchemaVersionsOperations: +class BillingContainersOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.deviceregistry.DeviceRegistryMgmtClient`'s - :attr:`schema_versions` attribute. + :attr:`billing_containers` attribute. """ def __init__(self, *args, **kwargs): @@ -6682,39 +2420,16 @@ def __init__(self, *args, **kwargs): @api_version_validation( method_added_on="2024-09-01-preview", params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "accept", - ] + "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "billing_container_name", "accept"] }, ) - def get( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - **kwargs: Any - ) -> _models.SchemaVersion: - """Get a SchemaVersion. + def get(self, billing_container_name: str, **kwargs: Any) -> _models.BillingContainer: + """Get a BillingContainer. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion + :param billing_container_name: Name of the billing container. Required. + :type billing_container_name: str + :return: BillingContainer. The BillingContainer is compatible with MutableMapping + :rtype: ~azure.mgmt.deviceregistry.models.BillingContainer :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6728,13 +2443,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SchemaVersion] = kwargs.pop("cls", None) + cls: ClsType[_models.BillingContainer] = kwargs.pop("cls", None) - _request = build_schema_versions_get_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_name, + _request = build_billing_containers_get_request( + billing_container_name=billing_container_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6765,215 +2477,7 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.SchemaVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: _models.SchemaVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Required. - :type resource: 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: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "content_type", - "accept", - ] - }, - ) - def create_or_replace( - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - resource: Union[_models.SchemaVersion, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.SchemaVersion: - """Create a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :param resource: Resource create parameters. Is one of the following types: SchemaVersion, - JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.deviceregistry.models.SchemaVersion or JSON or IO[bytes] - :return: SchemaVersion. The SchemaVersion is compatible with MutableMapping - :rtype: ~azure.mgmt.deviceregistry.models.SchemaVersion - :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.SchemaVersion] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_schema_versions_create_or_replace_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_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, 201]: - 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.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SchemaVersion, response.json()) + deserialized = _deserialize(_models.BillingContainer, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6983,120 +2487,19 @@ def create_or_replace( @distributed_trace @api_version_validation( method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "schema_version_name", - "accept", - ] - }, - ) - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - schema_registry_name: str, - schema_name: str, - schema_version_name: str, - **kwargs: Any - ) -> None: - """Delete a SchemaVersion. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :param schema_version_name: Schema version name parameter. Required. - :type schema_version_name: str - :return: None - :rtype: None - :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[None] = kwargs.pop("cls", None) - - _request = build_schema_versions_delete_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, - schema_version_name=schema_version_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 = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - @api_version_validation( - method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": [ - "base_url", - "api_version", - "subscription_id", - "resource_group_name", - "schema_registry_name", - "schema_name", - "accept", - ] - }, + params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, ) - def list_by_schema( - self, resource_group_name: str, schema_registry_name: str, schema_name: str, **kwargs: Any - ) -> Iterable["_models.SchemaVersion"]: - """List SchemaVersion resources by Schema. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BillingContainer"]: + """List BillingContainer resources by subscription ID. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param schema_registry_name: Schema registry name parameter. Required. - :type schema_registry_name: str - :param schema_name: Schema name parameter. Required. - :type schema_name: str - :return: An iterator like instance of SchemaVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.SchemaVersion] + :return: An iterator like instance of BillingContainer + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.deviceregistry.models.BillingContainer] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SchemaVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.BillingContainer]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7109,10 +2512,7 @@ def list_by_schema( def prepare_request(next_link=None): if not next_link: - _request = build_schema_versions_list_by_schema_request( - resource_group_name=resource_group_name, - schema_registry_name=schema_registry_name, - schema_name=schema_name, + _request = build_billing_containers_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7149,7 +2549,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SchemaVersion], deserialized["value"]) + list_of_elem = _deserialize(List[_models.BillingContainer], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile.py index 1725d2ebda4..cd536bc4068 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile.json +# x-ms-original-file: 2024-11-01/Create_AssetEndpointProfile.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile_with_discovered_aep_ref.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile_with_discovered_aep_ref.py index 07b84a9bed1..096971ef690 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile_with_discovered_aep_ref.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_endpoint_profile_with_discovered_aep_ref.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile_With_DiscoveredAepRef.json +# x-ms-original-file: 2024-11-01/Create_AssetEndpointProfile_With_DiscoveredAepRef.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_discovered_asset_ref.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_discovered_asset_ref.py index 96ff48441ec..05b46471e2f 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_discovered_asset_ref.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_discovered_asset_ref.py @@ -101,6 +101,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_Asset_With_DiscoveredAssetRef.json +# x-ms-original-file: 2024-11-01/Create_Asset_With_DiscoveredAssetRef.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_external_asset_id.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_external_asset_id.py index e944bceb296..7c39310ea58 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_external_asset_id.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_with_external_asset_id.py @@ -100,6 +100,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_Asset_With_ExternalAssetId.json +# x-ms-original-file: 2024-11-01/Create_Asset_With_ExternalAssetId.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_display_name.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_display_name.py index 1d46b6b9570..e853f7f9a9e 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_display_name.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_display_name.py @@ -99,6 +99,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_DisplayName.json +# x-ms-original-file: 2024-11-01/Create_Asset_Without_DisplayName.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_external_asset_id.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_external_asset_id.py index 9caf19777f2..add2f1edb9e 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_external_asset_id.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_asset_without_external_asset_id.py @@ -99,6 +99,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_ExternalAssetId.json +# x-ms-original-file: 2024-11-01/Create_Asset_Without_ExternalAssetId.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset.py deleted file mode 100644 index 7a5845d962c..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset.py +++ /dev/null @@ -1,99 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_discovered_asset.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.begin_create_or_replace( - resource_group_name="myResourceGroup", - discovered_asset_name="my-discoveredasset", - resource={ - "extendedLocation": { - "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", - "type": "CustomLocation", - }, - "location": "West Europe", - "properties": { - "assetEndpointProfileRef": "myAssetEndpointProfile", - "datasets": [ - { - "dataPoints": [ - { - "dataPointConfiguration": '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - "dataSource": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - "name": "dataPoint1", - }, - { - "dataPointConfiguration": '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - "dataSource": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - "name": "dataPoint2", - }, - ], - "datasetConfiguration": '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - "name": "dataset1", - "topic": {"path": "/path/dataset1", "retain": "Keep"}, - } - ], - "defaultDatasetsConfiguration": '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - "defaultEventsConfiguration": '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - "defaultTopic": {"path": "/path/defaultTopic", "retain": "Keep"}, - "discoveryId": "11111111-1111-1111-1111-111111111111", - "documentationUri": "https://www.example.com/manual", - "events": [ - { - "eventConfiguration": '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', - "eventNotifier": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - "name": "event1", - "topic": {"path": "/path/event1", "retain": "Keep"}, - }, - { - "eventConfiguration": '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', - "eventNotifier": "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - "name": "event2", - }, - ], - "hardwareRevision": "1.0", - "manufacturer": "Contoso", - "manufacturerUri": "https://www.contoso.com/manufacturerUri", - "model": "ContosoModel", - "productCode": "SA34VDG", - "serialNumber": "64-103816-519918-8", - "softwareRevision": "2.0", - "version": 73766, - }, - "tags": {"site": "building-1"}, - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAsset.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset_endpoint_profile.py deleted file mode 100644 index 96152091326..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_discovered_asset_endpoint_profile.py +++ /dev/null @@ -1,59 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_discovered_asset_endpoint_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.begin_create_or_replace( - resource_group_name="myResourceGroup", - discovered_asset_endpoint_profile_name="my-discoveredassetendpointprofile", - resource={ - "extendedLocation": { - "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", - "type": "CustomLocation", - }, - "location": "West Europe", - "properties": { - "additionalConfiguration": '{"foo": "bar"}', - "discoveryId": "11111111-1111-1111-1111-111111111111", - "endpointProfileType": "myEndpointProfileType", - "supportedAuthenticationMethods": ["Anonymous", "Certificate", "UsernamePassword"], - "targetAddress": "https://www.example.com/myTargetAddress", - "version": 73766, - }, - "tags": {"site": "building-1"}, - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema.py deleted file mode 100644 index 6fa73bce1cf..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema.py +++ /dev/null @@ -1,52 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_schema.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schemas.create_or_replace( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - resource={ - "properties": { - "description": "This is a sample Schema", - "displayName": "My Schema", - "format": "JsonSchema/draft-07", - "schemaType": "MessageSchema", - "tags": {"sampleKey": "sampleValue"}, - } - }, - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_Schema.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_registry.py deleted file mode 100644 index 7a876713aa4..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_registry.py +++ /dev/null @@ -1,53 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.begin_create_or_replace( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - resource={ - "identity": {"type": "None"}, - "location": "West Europe", - "properties": { - "description": "This is a sample Schema Registry", - "displayName": "Schema Registry namespace 001", - "namespace": "sr-namespace-001", - "storageAccountContainerUrl": "my-blob-storage.blob.core.windows.net/my-container", - }, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_SchemaRegistry.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_version.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_version.py deleted file mode 100644 index b75775f82fd..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/create_schema_version.py +++ /dev/null @@ -1,51 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python create_schema_version.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_versions.create_or_replace( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - schema_version_name="1", - resource={ - "properties": { - "description": "Schema version 1", - "schemaContent": '{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","properties": {"humidity": {"type": "string"},"temperature": {"type":"number"}}}', - } - }, - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Create_SchemaVersion.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset.py index 89de078084a..226ed5d5dd5 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2024-09-01-preview/Delete_Asset.json +# x-ms-original-file: 2024-11-01/Delete_Asset.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset_endpoint_profile.py index 266c6351978..61a9fed33fa 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset_endpoint_profile.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_asset_endpoint_profile.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2024-09-01-preview/Delete_AssetEndpointProfile.json +# x-ms-original-file: 2024-11-01/Delete_AssetEndpointProfile.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset.py deleted file mode 100644 index 9bf7988d729..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset.py +++ /dev/null @@ -1,41 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_discovered_asset.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.discovered_assets.begin_delete( - resource_group_name="myResourceGroup", - discovered_asset_name="my-discoveredasset", - ).result() - - -# x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAsset.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset_endpoint_profile.py deleted file mode 100644 index 830a41ad1f7..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_discovered_asset_endpoint_profile.py +++ /dev/null @@ -1,41 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_discovered_asset_endpoint_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.discovered_asset_endpoint_profiles.begin_delete( - resource_group_name="myResourceGroup", - discovered_asset_endpoint_profile_name="my-discoveredassetendpointprofile", - ).result() - - -# x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema.py deleted file mode 100644 index 6762c7a7d5c..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema.py +++ /dev/null @@ -1,42 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_schema.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.schemas.delete( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - ) - - -# x-ms-original-file: 2024-09-01-preview/Delete_Schema.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_registry.py deleted file mode 100644 index fc6dbff56ec..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_registry.py +++ /dev/null @@ -1,41 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.schema_registries.begin_delete( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - ).result() - - -# x-ms-original-file: 2024-09-01-preview/Delete_SchemaRegistry.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_version.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_version.py deleted file mode 100644 index 8c3046cd420..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/delete_schema_version.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python delete_schema_version.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - client.schema_versions.delete( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - schema_version_name="1", - ) - - -# x-ms-original-file: 2024-09-01-preview/Delete_SchemaVersion.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset.py index 0b9136e1a8d..d64b7dd5b1b 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_Asset.json +# x-ms-original-file: 2024-11-01/Get_Asset.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile.py index 4ebf469432a..38fe07d038e 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile.json +# x-ms-original-file: 2024-11-01/Get_AssetEndpointProfile.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile_with_sync_status.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile_with_sync_status.py index 663872bdaa0..5a259fb19e4 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile_with_sync_status.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_endpoint_profile_with_sync_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json +# x-ms-original-file: 2024-11-01/Get_AssetEndpointProfile_With_SyncStatus.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_with_sync_status.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_with_sync_status.py index 0524f35eb19..2b50d28fb2b 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_with_sync_status.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_asset_with_sync_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_Asset_With_SyncStatus.json +# x-ms-original-file: 2024-11-01/Get_Asset_With_SyncStatus.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_billing_container.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_billing_container.py index f49134c5b01..235cb9580e5 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_billing_container.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_billing_container.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_BillingContainer.json +# x-ms-original-file: 2024-11-01/Get_BillingContainer.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset.py deleted file mode 100644 index 6ea7fb7f37f..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset.py +++ /dev/null @@ -1,42 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_discovered_asset.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.get( - resource_group_name="myResourceGroup", - discovered_asset_name="my-discoveredasset", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAsset.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset_endpoint_profile.py deleted file mode 100644 index 32995e4920e..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_discovered_asset_endpoint_profile.py +++ /dev/null @@ -1,42 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_discovered_asset_endpoint_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.get( - resource_group_name="myResourceGroup", - discovered_asset_endpoint_profile_name="my-discoveredassetendpointprofile", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_operation_status.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_operation_status.py index 610f0ab6adb..ebe33643297 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_operation_status.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_operation_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Get_OperationStatus.json +# x-ms-original-file: 2024-11-01/Get_OperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema.py deleted file mode 100644 index 720e675cae1..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_schema.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schemas.get( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_Schema.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_registry.py deleted file mode 100644 index 1c74e95654d..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_registry.py +++ /dev/null @@ -1,42 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.get( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_SchemaRegistry.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_version.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_version.py deleted file mode 100644 index c387988112d..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/get_schema_version.py +++ /dev/null @@ -1,44 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python get_schema_version.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_versions.get( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - schema_version_name="1", - ) - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Get_SchemaVersion.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_resource_group.py index 37342fb70f5..0f3233036ce 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_resource_group.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json +# x-ms-original-file: 2024-11-01/List_AssetEndpointProfiles_ResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_subscription.py index 22ba2dcbd85..0f48246cb58 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_subscription.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_asset_endpoint_profiles_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json +# x-ms-original-file: 2024-11-01/List_AssetEndpointProfiles_Subscription.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_resource_group.py index 64bbd1af791..74598afe0b0 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_resource_group.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_Assets_ResourceGroup.json +# x-ms-original-file: 2024-11-01/List_Assets_ResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_subscription.py index cdf353af38d..b7ebd269521 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_subscription.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_assets_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_Assets_Subscription.json +# x-ms-original-file: 2024-11-01/List_Assets_Subscription.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_billing_containers_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_billing_containers_subscription.py index fd31e546f0b..e05233bb4fd 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_billing_containers_subscription.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_billing_containers_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_BillingContainers_Subscription.json +# x-ms-original-file: 2024-11-01/List_BillingContainers_Subscription.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_resource_group.py deleted file mode 100644 index 54a65475422..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_resource_group.py +++ /dev/null @@ -1,42 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_discovered_asset_endpoint_profiles_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_subscription.py deleted file mode 100644 index 44b48e92e60..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_asset_endpoint_profiles_subscription.py +++ /dev/null @@ -1,40 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_discovered_asset_endpoint_profiles_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_resource_group.py deleted file mode 100644 index cb866097e23..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_resource_group.py +++ /dev/null @@ -1,42 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_discovered_assets_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_subscription.py deleted file mode 100644 index 238b4ef5569..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_discovered_assets_subscription.py +++ /dev/null @@ -1,40 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_discovered_assets_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_operations.py index da062557939..583662f0e2b 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_operations.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2024-09-01-preview/List_Operations.json +# x-ms-original-file: 2024-11-01/List_Operations.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_resource_group.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_resource_group.py deleted file mode 100644 index f53ad566412..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_resource_group.py +++ /dev/null @@ -1,42 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_schema_registries_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.list_by_resource_group( - resource_group_name="myResourceGroup", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_subscription.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_subscription.py deleted file mode 100644 index fada853a4b7..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_registries_subscription.py +++ /dev/null @@ -1,40 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_schema_registries_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_Subscription.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_versions_schema.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_versions_schema.py deleted file mode 100644 index f68ba34b3aa..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schema_versions_schema.py +++ /dev/null @@ -1,44 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_schema_versions_schema.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_versions.list_by_schema( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - schema_name="my-schema", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_SchemaVersions_Schema.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schemas_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schemas_schema_registry.py deleted file mode 100644 index 59b990ffbd3..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/list_schemas_schema_registry.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python list_schemas_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schemas.list_by_schema_registry( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - ) - for item in response: - print(item) - - -# x-ms-original-file: 2024-09-01-preview/List_Schemas_SchemaRegistry.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py index ef72d641ef7..432d4d61973 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Update_Asset.json +# x-ms-original-file: 2024-11-01/Update_Asset.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset_endpoint_profile.py index 102c5e07e2d..be32b0cc163 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset_endpoint_profile.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_asset_endpoint_profile.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2024-09-01-preview/Update_AssetEndpointProfile.json +# x-ms-original-file: 2024-11-01/Update_AssetEndpointProfile.json if __name__ == "__main__": main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset.py deleted file mode 100644 index 4f53e66130c..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset.py +++ /dev/null @@ -1,48 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python update_discovered_asset.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_assets.begin_update( - resource_group_name="myResourceGroup", - discovered_asset_name="my-discoveredasset", - properties={ - "properties": { - "defaultTopic": {"path": "/path/defaultTopic", "retain": "Never"}, - "documentationUri": "https://www.example.com/manual-2", - } - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAsset.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset_endpoint_profile.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset_endpoint_profile.py deleted file mode 100644 index b4b43033f27..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_discovered_asset_endpoint_profile.py +++ /dev/null @@ -1,52 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python update_discovered_asset_endpoint_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.discovered_asset_endpoint_profiles.begin_update( - resource_group_name="myResourceGroup", - discovered_asset_endpoint_profile_name="my-discoveredassetendpointprofile", - properties={ - "properties": { - "additionalConfiguration": '{"foo": "bar"}', - "discoveryId": "11111111-1111-1111-1111-111111111111", - "endpointProfileType": "myEndpointProfileType", - "supportedAuthenticationMethods": ["Anonymous", "Certificate"], - "targetAddress": "https://www.example.com/myTargetAddress", - "version": 73766, - } - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_schema_registry.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_schema_registry.py deleted file mode 100644 index 2f7b7b11bc6..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_samples/update_schema_registry.py +++ /dev/null @@ -1,49 +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) 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.deviceregistry import DeviceRegistryMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-deviceregistry -# USAGE - python update_schema_registry.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = DeviceRegistryMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.schema_registries.begin_update( - resource_group_name="myResourceGroup", - schema_registry_name="my-schema-registry", - properties={ - "properties": { - "description": "This is a sample Schema Registry", - "displayName": "Schema Registry namespace 001", - }, - "tags": {}, - }, - ).result() - print(response) - - -# x-ms-original-file: 2024-09-01-preview/Update_SchemaRegistry.json -if __name__ == "__main__": - main() diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations.py deleted file mode 100644 index 8f24b8dd96b..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations.py +++ /dev/null @@ -1,117 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtDiscoveredAssetEndpointProfilesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_asset_endpoint_profiles_get(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.get( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_asset_endpoint_profiles_begin_create_or_replace(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.begin_create_or_replace( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - resource={ - "extendedLocation": {"name": "str", "type": "str"}, - "location": "str", - "id": "str", - "name": "str", - "properties": { - "discoveryId": "str", - "endpointProfileType": "str", - "targetAddress": "str", - "version": 0, - "additionalConfiguration": "str", - "provisioningState": "str", - "supportedAuthenticationMethods": ["str"], - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "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 - def test_discovered_asset_endpoint_profiles_begin_update(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.begin_update( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - properties={ - "properties": { - "additionalConfiguration": "str", - "discoveryId": "str", - "endpointProfileType": "str", - "supportedAuthenticationMethods": ["str"], - "targetAddress": "str", - "version": 0, - }, - "tags": {"str": "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 - def test_discovered_asset_endpoint_profiles_begin_delete(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.begin_delete( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_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 - def test_discovered_asset_endpoint_profiles_list_by_resource_group(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.list_by_resource_group( - resource_group_name=resource_group.name, - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_asset_endpoint_profiles_list_by_subscription(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.list_by_subscription() - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations_async.py deleted file mode 100644 index b0ebb3c3599..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_asset_endpoint_profiles_operations_async.py +++ /dev/null @@ -1,124 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtDiscoveredAssetEndpointProfilesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_asset_endpoint_profiles_get(self, resource_group): - response = await self.client.discovered_asset_endpoint_profiles.get( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_asset_endpoint_profiles_begin_create_or_replace(self, resource_group): - response = await ( - await self.client.discovered_asset_endpoint_profiles.begin_create_or_replace( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - resource={ - "extendedLocation": {"name": "str", "type": "str"}, - "location": "str", - "id": "str", - "name": "str", - "properties": { - "discoveryId": "str", - "endpointProfileType": "str", - "targetAddress": "str", - "version": 0, - "additionalConfiguration": "str", - "provisioningState": "str", - "supportedAuthenticationMethods": ["str"], - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "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_discovered_asset_endpoint_profiles_begin_update(self, resource_group): - response = await ( - await self.client.discovered_asset_endpoint_profiles.begin_update( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_name="str", - properties={ - "properties": { - "additionalConfiguration": "str", - "discoveryId": "str", - "endpointProfileType": "str", - "supportedAuthenticationMethods": ["str"], - "targetAddress": "str", - "version": 0, - }, - "tags": {"str": "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_discovered_asset_endpoint_profiles_begin_delete(self, resource_group): - response = await ( - await self.client.discovered_asset_endpoint_profiles.begin_delete( - resource_group_name=resource_group.name, - discovered_asset_endpoint_profile_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_discovered_asset_endpoint_profiles_list_by_resource_group(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.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_discovered_asset_endpoint_profiles_list_by_subscription(self, resource_group): - response = self.client.discovered_asset_endpoint_profiles.list_by_subscription() - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations.py deleted file mode 100644 index 3a9cb74a552..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations.py +++ /dev/null @@ -1,180 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtDiscoveredAssetsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_assets_get(self, resource_group): - response = self.client.discovered_assets.get( - resource_group_name=resource_group.name, - discovered_asset_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_assets_begin_create_or_replace(self, resource_group): - response = self.client.discovered_assets.begin_create_or_replace( - resource_group_name=resource_group.name, - discovered_asset_name="str", - resource={ - "extendedLocation": {"name": "str", "type": "str"}, - "location": "str", - "id": "str", - "name": "str", - "properties": { - "assetEndpointProfileRef": "str", - "discoveryId": "str", - "version": 0, - "datasets": [ - { - "name": "str", - "dataPoints": [ - { - "dataSource": "str", - "name": "str", - "dataPointConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - } - ], - "datasetConfiguration": "str", - "topic": {"path": "str", "retain": "str"}, - } - ], - "defaultDatasetsConfiguration": "str", - "defaultEventsConfiguration": "str", - "defaultTopic": {"path": "str", "retain": "str"}, - "documentationUri": "str", - "events": [ - { - "eventNotifier": "str", - "name": "str", - "eventConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - "topic": {"path": "str", "retain": "str"}, - } - ], - "hardwareRevision": "str", - "manufacturer": "str", - "manufacturerUri": "str", - "model": "str", - "productCode": "str", - "provisioningState": "str", - "serialNumber": "str", - "softwareRevision": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "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 - def test_discovered_assets_begin_update(self, resource_group): - response = self.client.discovered_assets.begin_update( - resource_group_name=resource_group.name, - discovered_asset_name="str", - properties={ - "properties": { - "datasets": [ - { - "name": "str", - "dataPoints": [ - { - "dataSource": "str", - "name": "str", - "dataPointConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - } - ], - "datasetConfiguration": "str", - "topic": {"path": "str", "retain": "str"}, - } - ], - "defaultDatasetsConfiguration": "str", - "defaultEventsConfiguration": "str", - "defaultTopic": {"path": "str", "retain": "str"}, - "discoveryId": "str", - "documentationUri": "str", - "events": [ - { - "eventNotifier": "str", - "name": "str", - "eventConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - "topic": {"path": "str", "retain": "str"}, - } - ], - "hardwareRevision": "str", - "manufacturer": "str", - "manufacturerUri": "str", - "model": "str", - "productCode": "str", - "serialNumber": "str", - "softwareRevision": "str", - "version": 0, - }, - "tags": {"str": "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 - def test_discovered_assets_begin_delete(self, resource_group): - response = self.client.discovered_assets.begin_delete( - resource_group_name=resource_group.name, - discovered_asset_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 - def test_discovered_assets_list_by_resource_group(self, resource_group): - response = self.client.discovered_assets.list_by_resource_group( - resource_group_name=resource_group.name, - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_discovered_assets_list_by_subscription(self, resource_group): - response = self.client.discovered_assets.list_by_subscription() - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations_async.py deleted file mode 100644 index 45e7d48e863..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_discovered_assets_operations_async.py +++ /dev/null @@ -1,187 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtDiscoveredAssetsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_assets_get(self, resource_group): - response = await self.client.discovered_assets.get( - resource_group_name=resource_group.name, - discovered_asset_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_discovered_assets_begin_create_or_replace(self, resource_group): - response = await ( - await self.client.discovered_assets.begin_create_or_replace( - resource_group_name=resource_group.name, - discovered_asset_name="str", - resource={ - "extendedLocation": {"name": "str", "type": "str"}, - "location": "str", - "id": "str", - "name": "str", - "properties": { - "assetEndpointProfileRef": "str", - "discoveryId": "str", - "version": 0, - "datasets": [ - { - "name": "str", - "dataPoints": [ - { - "dataSource": "str", - "name": "str", - "dataPointConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - } - ], - "datasetConfiguration": "str", - "topic": {"path": "str", "retain": "str"}, - } - ], - "defaultDatasetsConfiguration": "str", - "defaultEventsConfiguration": "str", - "defaultTopic": {"path": "str", "retain": "str"}, - "documentationUri": "str", - "events": [ - { - "eventNotifier": "str", - "name": "str", - "eventConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - "topic": {"path": "str", "retain": "str"}, - } - ], - "hardwareRevision": "str", - "manufacturer": "str", - "manufacturerUri": "str", - "model": "str", - "productCode": "str", - "provisioningState": "str", - "serialNumber": "str", - "softwareRevision": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "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_discovered_assets_begin_update(self, resource_group): - response = await ( - await self.client.discovered_assets.begin_update( - resource_group_name=resource_group.name, - discovered_asset_name="str", - properties={ - "properties": { - "datasets": [ - { - "name": "str", - "dataPoints": [ - { - "dataSource": "str", - "name": "str", - "dataPointConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - } - ], - "datasetConfiguration": "str", - "topic": {"path": "str", "retain": "str"}, - } - ], - "defaultDatasetsConfiguration": "str", - "defaultEventsConfiguration": "str", - "defaultTopic": {"path": "str", "retain": "str"}, - "discoveryId": "str", - "documentationUri": "str", - "events": [ - { - "eventNotifier": "str", - "name": "str", - "eventConfiguration": "str", - "lastUpdatedOn": "2020-02-20 00:00:00", - "topic": {"path": "str", "retain": "str"}, - } - ], - "hardwareRevision": "str", - "manufacturer": "str", - "manufacturerUri": "str", - "model": "str", - "productCode": "str", - "serialNumber": "str", - "softwareRevision": "str", - "version": 0, - }, - "tags": {"str": "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_discovered_assets_begin_delete(self, resource_group): - response = await ( - await self.client.discovered_assets.begin_delete( - resource_group_name=resource_group.name, - discovered_asset_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_discovered_assets_list_by_resource_group(self, resource_group): - response = self.client.discovered_assets.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_discovered_assets_list_by_subscription(self, resource_group): - response = self.client.discovered_assets.list_by_subscription() - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations.py deleted file mode 100644 index 5ac65283510..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations.py +++ /dev/null @@ -1,110 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemaRegistriesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_registries_get(self, resource_group): - response = self.client.schema_registries.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_registries_begin_create_or_replace(self, resource_group): - response = self.client.schema_registries.begin_create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - resource={ - "location": "str", - "id": "str", - "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, - "name": "str", - "properties": { - "namespace": "str", - "storageAccountContainerUrl": "str", - "description": "str", - "displayName": "str", - "provisioningState": "str", - "uuid": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "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 - def test_schema_registries_begin_update(self, resource_group): - response = self.client.schema_registries.begin_update( - resource_group_name=resource_group.name, - schema_registry_name="str", - properties={ - "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, - "properties": {"description": "str", "displayName": "str"}, - "tags": {"str": "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 - def test_schema_registries_begin_delete(self, resource_group): - response = self.client.schema_registries.begin_delete( - resource_group_name=resource_group.name, - schema_registry_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 - def test_schema_registries_list_by_resource_group(self, resource_group): - response = self.client.schema_registries.list_by_resource_group( - resource_group_name=resource_group.name, - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_registries_list_by_subscription(self, resource_group): - response = self.client.schema_registries.list_by_subscription() - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations_async.py deleted file mode 100644 index 1ea2592f92d..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_registries_operations_async.py +++ /dev/null @@ -1,117 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemaRegistriesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_registries_get(self, resource_group): - response = await self.client.schema_registries.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_registries_begin_create_or_replace(self, resource_group): - response = await ( - await self.client.schema_registries.begin_create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - resource={ - "location": "str", - "id": "str", - "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, - "name": "str", - "properties": { - "namespace": "str", - "storageAccountContainerUrl": "str", - "description": "str", - "displayName": "str", - "provisioningState": "str", - "uuid": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "type": "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_schema_registries_begin_update(self, resource_group): - response = await ( - await self.client.schema_registries.begin_update( - resource_group_name=resource_group.name, - schema_registry_name="str", - properties={ - "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, - "properties": {"description": "str", "displayName": "str"}, - "tags": {"str": "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_schema_registries_begin_delete(self, resource_group): - response = await ( - await self.client.schema_registries.begin_delete( - resource_group_name=resource_group.name, - schema_registry_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_schema_registries_list_by_resource_group(self, resource_group): - response = self.client.schema_registries.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_schema_registries_list_by_subscription(self, resource_group): - response = self.client.schema_registries.list_by_subscription() - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations.py deleted file mode 100644 index b3d8ec7fec5..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations.py +++ /dev/null @@ -1,90 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemaVersionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_versions_get(self, resource_group): - response = self.client.schema_versions.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_versions_create_or_replace(self, resource_group): - response = self.client.schema_versions.create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - resource={ - "id": "str", - "name": "str", - "properties": { - "schemaContent": "str", - "description": "str", - "hash": "str", - "provisioningState": "str", - "uuid": "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", - }, - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_versions_delete(self, resource_group): - response = self.client.schema_versions.delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schema_versions_list_by_schema(self, resource_group): - response = self.client.schema_versions.list_by_schema( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations_async.py deleted file mode 100644 index 059ce427d8e..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schema_versions_operations_async.py +++ /dev/null @@ -1,91 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemaVersionsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_versions_get(self, resource_group): - response = await self.client.schema_versions.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_versions_create_or_replace(self, resource_group): - response = await self.client.schema_versions.create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - resource={ - "id": "str", - "name": "str", - "properties": { - "schemaContent": "str", - "description": "str", - "hash": "str", - "provisioningState": "str", - "uuid": "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", - }, - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_versions_delete(self, resource_group): - response = await self.client.schema_versions.delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - schema_version_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schema_versions_list_by_schema(self, resource_group): - response = self.client.schema_versions.list_by_schema( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations.py deleted file mode 100644 index a588eaba29c..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations.py +++ /dev/null @@ -1,88 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemasOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schemas_get(self, resource_group): - response = self.client.schemas.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schemas_create_or_replace(self, resource_group): - response = self.client.schemas.create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - resource={ - "id": "str", - "name": "str", - "properties": { - "format": "str", - "schemaType": "str", - "description": "str", - "displayName": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "uuid": "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", - }, - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schemas_delete(self, resource_group): - response = self.client.schemas.delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_schemas_list_by_schema_registry(self, resource_group): - response = self.client.schemas.list_by_schema_registry( - resource_group_name=resource_group.name, - schema_registry_name="str", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations_async.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations_async.py deleted file mode 100644 index f8301bd7981..00000000000 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/generated_tests/test_device_registry_mgmt_schemas_operations_async.py +++ /dev/null @@ -1,89 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.deviceregistry.aio import DeviceRegistryMgmtClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestDeviceRegistryMgmtSchemasOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(DeviceRegistryMgmtClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schemas_get(self, resource_group): - response = await self.client.schemas.get( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schemas_create_or_replace(self, resource_group): - response = await self.client.schemas.create_or_replace( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - resource={ - "id": "str", - "name": "str", - "properties": { - "format": "str", - "schemaType": "str", - "description": "str", - "displayName": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "uuid": "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", - }, - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schemas_delete(self, resource_group): - response = await self.client.schemas.delete( - resource_group_name=resource_group.name, - schema_registry_name="str", - schema_name="str", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_schemas_list_by_schema_registry(self, resource_group): - response = self.client.schemas.list_by_schema_registry( - resource_group_name=resource_group.name, - schema_registry_name="str", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/setup.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/setup.py index 2ea6f92b7ed..d48695cb5e6 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/setup.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/setup.py @@ -49,7 +49,7 @@ 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", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml b/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml index 24019423375..6cf04ccb499 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/deviceregistry/DeviceRegistry.Management -commit: f6674831693bce0982f08ccf356255248a4c9a8f +commit: fbb413f68a8ca8acf5f03ac50fbf54a63cf1d716 repo: Azure/azure-rest-api-specs additionalDirectories: