diff --git a/.chronus/changes/update_tcgc-2024-4-9-16-55-0.md b/.chronus/changes/update_tcgc-2024-4-9-16-55-0.md new file mode 100644 index 00000000000..e5154935779 --- /dev/null +++ b/.chronus/changes/update_tcgc-2024-4-9-16-55-0.md @@ -0,0 +1,7 @@ +--- +changeKind: dependencies +packages: + - "@azure-tools/typespec-python" +--- + +bump tcgc to 0.42.1 \ No newline at end of file diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index 3b4f428eab3..2efa34fc135 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -42,15 +42,15 @@ "get-autorest-python-path.cjs" ], "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.41.0 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.41.0 <1.0.0", - "@azure-tools/typespec-autorest": ">=0.41.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.41.8 <1.0.0", - "@typespec/compiler": ">=0.55.0 <1.0.0", - "@typespec/http": ">=0.55.0 <1.0.0", - "@typespec/rest": ">=0.55.0 <1.0.0", - "@typespec/versioning": ">=0.55.0 <1.0.0", - "@typespec/openapi": ">=0.55.0 <1.0.0" + "@azure-tools/typespec-azure-core": ">=0.42.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.42.0 <1.0.0", + "@azure-tools/typespec-autorest": ">=0.42.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.42.2 <1.0.0", + "@typespec/compiler": ">=0.56.0 <1.0.0", + "@typespec/http": ">=0.56.0 <1.0.0", + "@typespec/rest": ">=0.56.0 <1.0.0", + "@typespec/versioning": ">=0.56.0 <1.0.0", + "@typespec/openapi": ">=0.56.0 <1.0.0" }, "dependenciesMeta": { "@azure-tools/typespec-client-generator-core": { @@ -60,28 +60,28 @@ "dependencies": { "@autorest/python": "workspace:^", "js-yaml": "~4.1.0", - "@typespec/openapi3": "~0.55.0" + "@typespec/openapi3": "~0.56.0" }, "devDependencies": { - "@azure-tools/typespec-azure-resource-manager": "~0.41.0", - "@azure-tools/typespec-autorest": "~0.41.0", - "@azure-tools/cadl-ranch-expect": "~0.13.3", - "@azure-tools/cadl-ranch-specs": "~0.33.2", + "@azure-tools/typespec-azure-resource-manager": "~0.42.0", + "@azure-tools/typespec-autorest": "~0.42.0", + "@azure-tools/cadl-ranch-expect": "~0.13.4", + "@azure-tools/cadl-ranch-specs": "~0.33.4", "@types/js-yaml": "~4.0.5", "@types/mocha": "~10.0.1", "@types/node": "^18.16.3", "@typespec/eslint-config-typespec": "~0.55.0", - "@typespec/openapi": "~0.55.0", + "@typespec/openapi": "~0.56.0", "c8": "~7.13.0", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "mocha": "~10.2.0", "rimraf": "~5.0.0", "typescript": "~5.1.3", - "@azure-tools/typespec-azure-core": "~0.41.0", - "@azure-tools/typespec-client-generator-core": "~0.41.8", - "@typespec/compiler": "~0.55.0", - "@typespec/http": "~0.55.0", - "@typespec/rest": "~0.55.0", - "@typespec/versioning": "~0.55.0" + "@azure-tools/typespec-azure-core": "~0.42.0", + "@azure-tools/typespec-client-generator-core": "~0.42.2", + "@typespec/compiler": "~0.56.0", + "@typespec/http": "~0.56.0", + "@typespec/rest": "~0.56.0", + "@typespec/versioning": "~0.56.0" } } diff --git a/packages/typespec-python/src/utils.ts b/packages/typespec-python/src/utils.ts index ccb9aa31070..412119cef1a 100644 --- a/packages/typespec-python/src/utils.ts +++ b/packages/typespec-python/src/utils.ts @@ -77,8 +77,13 @@ export function getAddedOn( context: PythonSdkContext, type: SdkModelPropertyType | SdkMethod, ): string | undefined { - // We only want added on if it's not the same as the client's added on - if (type.apiVersions[0] === context.experimental_sdkPackage.clients[0].apiVersions[0]) return undefined; + // since we do not support multi-service for now, we can just check the root client's api version + // if type is added in the first version of the client, we do not need to add the versioning info + if ( + type.apiVersions[0] === + context.experimental_sdkPackage.clients.find((c) => c.initialization.access === "public")?.apiVersions[0] + ) + return undefined; return type.apiVersions[0]; } diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/apiview_mapping_python.json deleted file mode 100644 index b351c64f20d..00000000000 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/apiview_mapping_python.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "CrossLanguagePackageId": "Authentication.Union", - "CrossLanguageDefinitionId": { - "authentication.union.UnionClient.valid_key": "validKey", - "authentication.union.UnionClient.valid_token": "validToken" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/apiview_mapping_python.json deleted file mode 100644 index 3b314fe39e6..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/apiview_mapping_python.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.ClientGenerator.Core.Usage", - "CrossLanguageDefinitionId": { - "specs.azure.clientgenerator.core.usage.models.InputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.InputModel", - "specs.azure.clientgenerator.core.usage.models.OrphanModel": "_Specs_.Azure.ClientGenerator.Core.Usage.OrphanModel", - "specs.azure.clientgenerator.core.usage.models.OutputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.OutputModel", - "specs.azure.clientgenerator.core.usage.UsageClient.model_in_operation.input_to_input_output": "inputToInputOutput", - "specs.azure.clientgenerator.core.usage.UsageClient.model_in_operation.output_to_input_output": "outputToInputOutput" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/apiview_mapping_python.json deleted file mode 100644 index 243ce130cf5..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/apiview_mapping_python.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Basic", - "CrossLanguageDefinitionId": { - "specs.azure.core.basic.models.FirstItem": "_Specs_.Azure.Core.Basic.FirstItem", - "specs.azure.core.basic.models.ListItemInputBody": "_Specs_.Azure.Core.Basic.ListItemInputBody", - "specs.azure.core.basic.models.SecondItem": "_Specs_.Azure.Core.Basic.SecondItem", - "specs.azure.core.basic.models.User": "_Specs_.Azure.Core.Basic.User", - "specs.azure.core.basic.models.UserListResults": "_Specs_.Azure.Core.Basic.CustomPageModel", - "specs.azure.core.basic.models.UserOrder": "_Specs_.Azure.Core.Basic.UserOrder", - "specs.azure.core.basic.models.ListItemInputExtensibleEnum": "_Specs_.Azure.Core.Basic.ListItemInputExtensibleEnum", - "specs.azure.core.basic.BasicClient.two_models_as_page_item.list_first_item": "listFirstItem", - "specs.azure.core.basic.BasicClient.two_models_as_page_item.list_second_item": "listSecondItem", - "specs.azure.core.basic.BasicClient.create_or_update": "createOrUpdate", - "specs.azure.core.basic.BasicClient.create_or_replace": "createOrReplace", - "specs.azure.core.basic.BasicClient.get": "get", - "specs.azure.core.basic.BasicClient.list": "list", - "specs.azure.core.basic.BasicClient.list_with_page": "listWithPage", - "specs.azure.core.basic.BasicClient.list_with_parameters": "listWithParameters", - "specs.azure.core.basic.BasicClient.list_with_custom_page_model": "listWithCustomPageModel", - "specs.azure.core.basic.BasicClient.delete": "delete", - "specs.azure.core.basic.BasicClient.export": "export" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/apiview_mapping_python.json deleted file mode 100644 index d4c18a09651..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/apiview_mapping_python.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Lro.Standard", - "CrossLanguageDefinitionId": { - "specs.azure.core.lro.standard.models.ExportedUser": "_Specs_.Azure.Core.Lro.Standard.ExportedUser", - "specs.azure.core.lro.standard.models.User": "_Specs_.Azure.Core.Lro.Standard.User", - "specs.azure.core.lro.standard.StandardClient.begin_create_or_replace": "createOrReplace", - "specs.azure.core.lro.standard.StandardClient.begin_delete": "delete", - "specs.azure.core.lro.standard.StandardClient.begin_export": "export" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/apiview_mapping_python.json deleted file mode 100644 index 460480959e7..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/apiview_mapping_python.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Scalar", - "CrossLanguageDefinitionId": { - "specs.azure.core.scalar.models.AzureLocationModel": "_Specs_.Azure.Core.Scalar.AzureLocationModel", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.get": "get", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.put": "put", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.post": "post", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.header": "header", - "specs.azure.core.scalar.ScalarClient.azure_location_scalar.query": "query" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/apiview_mapping_python.json deleted file mode 100644 index 7035a181b8d..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/apiview_mapping_python.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Traits", - "CrossLanguageDefinitionId": { - "specs.azure.core.traits.models.User": "_Specs_.Azure.Core.Traits.User", - "specs.azure.core.traits.models.UserActionParam": "_Specs_.Azure.Core.Traits.UserActionParam", - "specs.azure.core.traits.models.UserActionResponse": "_Specs_.Azure.Core.Traits.UserActionResponse", - "specs.azure.core.traits.models.RepeatabilityResult": "Azure.Core.RepeatabilityResult", - "specs.azure.core.traits.TraitsClient.smoke_test": "smokeTest", - "specs.azure.core.traits.TraitsClient.repeatable_action": "repeatableAction" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/apiview_mapping_python.json index 9b0f1a46276..ad276dc8108 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/apiview_mapping_python.json +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/apiview_mapping_python.json @@ -1,22 +1,21 @@ { "CrossLanguagePackageId": "Microsoft.AzureSphere", "CrossLanguageDefinitionId": { - "azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState": "Azure.ResourceManager.ArmOperationStatus", - "azure.mgmt.spheredpg.models.ArmResourceBase": "Azure.ResourceManager.Foundations.ArmResourceBase", - "azure.mgmt.spheredpg.models.ArmResource": "Azure.ResourceManager.Foundations.ArmResource", - "azure.mgmt.spheredpg.models.TrackedResourceBase": "Azure.ResourceManager.Foundations.TrackedResourceBase", + "azure.mgmt.spheredpg.models.ArmOperationStatus": "Azure.ResourceManager.ArmOperationStatus", + "azure.mgmt.spheredpg.models.Resource": "Azure.ResourceManager.Foundations.Resource", + "azure.mgmt.spheredpg.models.TrackedResource": "Azure.ResourceManager.Foundations.TrackedResource", "azure.mgmt.spheredpg.models.Catalog": "Microsoft.AzureSphere.Catalog", "azure.mgmt.spheredpg.models.CatalogListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.CatalogProperties": "Microsoft.AzureSphere.CatalogProperties", - "azure.mgmt.spheredpg.models.CatalogUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.ProxyResourceBase": "Azure.ResourceManager.Foundations.ProxyResourceBase", + "azure.mgmt.spheredpg.models.CatalogUpdate": "Microsoft.AzureSphere.CatalogUpdate", + "azure.mgmt.spheredpg.models.ProxyResource": "Azure.ResourceManager.Foundations.ProxyResource", "azure.mgmt.spheredpg.models.Certificate": "Microsoft.AzureSphere.Certificate", "azure.mgmt.spheredpg.models.CertificateChainResponse": "Microsoft.AzureSphere.CertificateChainResponse", "azure.mgmt.spheredpg.models.CertificateListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.CertificateProperties": "Microsoft.AzureSphere.CertificateProperties", "azure.mgmt.spheredpg.models.ClaimDevicesRequest": "Microsoft.AzureSphere.ClaimDevicesRequest", "azure.mgmt.spheredpg.models.CountElementsResponse": "Microsoft.AzureSphere.CountElementsResponse", - "azure.mgmt.spheredpg.models.CountDeviceResponse": "Microsoft.AzureSphere.CountDeviceResponse", + "azure.mgmt.spheredpg.models.CountDevicesResponse": "Microsoft.AzureSphere.CountDevicesResponse", "azure.mgmt.spheredpg.models.Deployment": "Microsoft.AzureSphere.Deployment", "azure.mgmt.spheredpg.models.DeploymentListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.DeploymentProperties": "Microsoft.AzureSphere.DeploymentProperties", @@ -24,13 +23,13 @@ "azure.mgmt.spheredpg.models.DeviceGroup": "Microsoft.AzureSphere.DeviceGroup", "azure.mgmt.spheredpg.models.DeviceGroupListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.DeviceGroupProperties": "Microsoft.AzureSphere.DeviceGroupProperties", - "azure.mgmt.spheredpg.models.DeviceGroupUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.DeviceGroupUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.spheredpg.models.DeviceGroupUpdate": "Microsoft.AzureSphere.DeviceGroupUpdate", + "azure.mgmt.spheredpg.models.DeviceGroupUpdateProperties": "Microsoft.AzureSphere.DeviceGroupUpdateProperties", "azure.mgmt.spheredpg.models.DeviceInsight": "Microsoft.AzureSphere.DeviceInsight", "azure.mgmt.spheredpg.models.DeviceListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.DeviceProperties": "Microsoft.AzureSphere.DeviceProperties", - "azure.mgmt.spheredpg.models.DeviceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.DeviceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.spheredpg.models.DeviceUpdate": "Microsoft.AzureSphere.DeviceUpdate", + "azure.mgmt.spheredpg.models.DeviceUpdateProperties": "Microsoft.AzureSphere.DeviceUpdateProperties", "azure.mgmt.spheredpg.models.ErrorAdditionalInfo": "Azure.ResourceManager.Foundations.ErrorAdditionalInfo", "azure.mgmt.spheredpg.models.ErrorDetail": "Azure.ResourceManager.Foundations.ErrorDetail", "azure.mgmt.spheredpg.models.ErrorResponse": "Azure.ResourceManager.ErrorResponse", @@ -41,12 +40,13 @@ "azure.mgmt.spheredpg.models.ListDeviceGroupsRequest": "Microsoft.AzureSphere.ListDeviceGroupsRequest", "azure.mgmt.spheredpg.models.Operation": "Azure.ResourceManager.Foundations.Operation", "azure.mgmt.spheredpg.models.OperationDisplay": "Azure.ResourceManager.Foundations.OperationDisplay", + "azure.mgmt.spheredpg.models.PagedDeviceInsight": "Microsoft.AzureSphere.PagedDeviceInsight", "azure.mgmt.spheredpg.models.PagedOperation": "Azure.ResourceManager.Foundations.OperationListResult", "azure.mgmt.spheredpg.models.Product": "Microsoft.AzureSphere.Product", "azure.mgmt.spheredpg.models.ProductListResult": "Azure.ResourceManager.ResourceListResult", "azure.mgmt.spheredpg.models.ProductProperties": "Microsoft.AzureSphere.ProductProperties", - "azure.mgmt.spheredpg.models.ProductUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.ProductUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.spheredpg.models.ProductUpdate": "Microsoft.AzureSphere.ProductUpdate", + "azure.mgmt.spheredpg.models.ProductUpdateProperties": "Microsoft.AzureSphere.ProductUpdateProperties", "azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest": "Microsoft.AzureSphere.ProofOfPossessionNonceRequest", "azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse": "Microsoft.AzureSphere.ProofOfPossessionNonceResponse", "azure.mgmt.spheredpg.models.SignedCapabilityImageResponse": "Microsoft.AzureSphere.SignedCapabilityImageResponse", @@ -54,58 +54,59 @@ "azure.mgmt.spheredpg.models.CreatedByType": "Azure.ResourceManager.Foundations.createdByType", "azure.mgmt.spheredpg.models.ProvisioningState": "Microsoft.AzureSphere.ProvisioningState", "azure.mgmt.spheredpg.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", + "azure.mgmt.spheredpg.models.CapabilityType": "Microsoft.AzureSphere.CapabilityType", + "azure.mgmt.spheredpg.models.RegionalDataBoundary": "Microsoft.AzureSphere.RegionalDataBoundary", + "azure.mgmt.spheredpg.models.ImageType": "Microsoft.AzureSphere.ImageType", "azure.mgmt.spheredpg.models.OSFeedType": "Microsoft.AzureSphere.OSFeedType", "azure.mgmt.spheredpg.models.UpdatePolicy": "Microsoft.AzureSphere.UpdatePolicy", "azure.mgmt.spheredpg.models.AllowCrashDumpCollection": "Microsoft.AzureSphere.AllowCrashDumpCollection", - "azure.mgmt.spheredpg.models.RegionalDataBoundary": "Microsoft.AzureSphere.RegionalDataBoundary", - "azure.mgmt.spheredpg.models.CapabilityType": "Microsoft.AzureSphere.CapabilityType", - "azure.mgmt.spheredpg.models.ImageType": "Microsoft.AzureSphere.ImageType", "azure.mgmt.spheredpg.models.CertificateStatus": "Microsoft.AzureSphere.CertificateStatus", "azure.mgmt.spheredpg.models.Origin": "Azure.ResourceManager.Foundations.Origin", "azure.mgmt.spheredpg.models.ActionType": "Azure.ResourceManager.Foundations.ActionType", "azure.mgmt.spheredpg.AzureSphereClient.operations.list": "Azure.ResourceManager.Operations.list", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.get": "Azure.ResourceManager.Catalogs.get", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_create_or_update": "Azure.ResourceManager.Catalogs.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.update": "Azure.ResourceManager.Catalogs.update", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_delete": "Azure.ResourceManager.Catalogs.delete", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_resource_group": "Azure.ResourceManager.Catalogs.listByResourceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_subscription": "Azure.ResourceManager.Catalogs.listBySubscription", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.get": "Microsoft.AzureSphere.Catalogs.get", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_create_or_update": "Microsoft.AzureSphere.Catalogs.createOrUpdate", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.update": "Microsoft.AzureSphere.Catalogs.update", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_delete": "Microsoft.AzureSphere.Catalogs.delete", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_resource_group": "Microsoft.AzureSphere.Catalogs.listByResourceGroup", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_subscription": "Microsoft.AzureSphere.Catalogs.listBySubscription", "azure.mgmt.spheredpg.AzureSphereClient.catalogs.count_devices": "Microsoft.AzureSphere.Catalogs.countDevices", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_insights": "Microsoft.AzureSphere.Catalogs.listDeviceInsights", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_devices": "Microsoft.AzureSphere.Catalogs.listDevices", "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_deployments": "Microsoft.AzureSphere.Catalogs.listDeployments", "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_groups": "Microsoft.AzureSphere.Catalogs.listDeviceGroups", - "azure.mgmt.spheredpg.AzureSphereClient.images.get": "Azure.ResourceManager.Images.get", - "azure.mgmt.spheredpg.AzureSphereClient.images.list_by_catalog": "Azure.ResourceManager.Images.listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.images.begin_create_or_update": "Azure.ResourceManager.Images.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.images.begin_delete": "Azure.ResourceManager.Images.delete", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.list_by_product": "Microsoft.AzureSphere.DeviceGroups.listByProduct", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_insights": "Microsoft.AzureSphere.Catalogs.listDeviceInsights", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_devices": "Microsoft.AzureSphere.Catalogs.listDevices", + "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_upload_image": "Microsoft.AzureSphere.Catalogs.uploadImage", + "azure.mgmt.spheredpg.AzureSphereClient.certificates.get": "Microsoft.AzureSphere.Certificates.get", + "azure.mgmt.spheredpg.AzureSphereClient.certificates.list_by_catalog": "Microsoft.AzureSphere.Certificates.listByCatalog", + "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_cert_chain": "Microsoft.AzureSphere.Certificates.retrieveCertChain", + "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_proof_of_possession_nonce": "Microsoft.AzureSphere.Certificates.retrieveProofOfPossessionNonce", + "azure.mgmt.spheredpg.AzureSphereClient.images.get": "Microsoft.AzureSphere.Images.get", + "azure.mgmt.spheredpg.AzureSphereClient.images.begin_create_or_update": "Microsoft.AzureSphere.Images.createOrUpdate", + "azure.mgmt.spheredpg.AzureSphereClient.images.begin_delete": "Microsoft.AzureSphere.Images.delete", + "azure.mgmt.spheredpg.AzureSphereClient.images.list_by_catalog": "Microsoft.AzureSphere.Images.listByCatalog", + "azure.mgmt.spheredpg.AzureSphereClient.products.get": "Microsoft.AzureSphere.Products.get", + "azure.mgmt.spheredpg.AzureSphereClient.products.begin_create_or_update": "Microsoft.AzureSphere.Products.createOrUpdate", + "azure.mgmt.spheredpg.AzureSphereClient.products.begin_update": "Microsoft.AzureSphere.Products.update", + "azure.mgmt.spheredpg.AzureSphereClient.products.begin_delete": "Microsoft.AzureSphere.Products.delete", + "azure.mgmt.spheredpg.AzureSphereClient.products.list_by_catalog": "Microsoft.AzureSphere.Products.listByCatalog", + "azure.mgmt.spheredpg.AzureSphereClient.products.count_devices": "Microsoft.AzureSphere.Products.countDevices", + "azure.mgmt.spheredpg.AzureSphereClient.products.generate_default_device_groups": "Microsoft.AzureSphere.Products.generateDefaultDeviceGroups", "azure.mgmt.spheredpg.AzureSphereClient.device_groups.get": "Microsoft.AzureSphere.DeviceGroups.get", "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_create_or_update": "Microsoft.AzureSphere.DeviceGroups.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_delete": "Microsoft.AzureSphere.DeviceGroups.delete", "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_update": "Microsoft.AzureSphere.DeviceGroups.update", + "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_delete": "Microsoft.AzureSphere.DeviceGroups.delete", + "azure.mgmt.spheredpg.AzureSphereClient.device_groups.list_by_product": "Microsoft.AzureSphere.DeviceGroups.listByProduct", + "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_claim_devices": "Microsoft.AzureSphere.DeviceGroups.claimDevices", "azure.mgmt.spheredpg.AzureSphereClient.device_groups.count_devices": "Microsoft.AzureSphere.DeviceGroups.countDevices", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.claim_devices": "Microsoft.AzureSphere.DeviceGroups.claimDevices", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.get": "Azure.ResourceManager.Certificates.get", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.list_by_catalog": "Azure.ResourceManager.Certificates.listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_cert_chain": "Microsoft.AzureSphere.Certificates.retrieveCertChain", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_proof_of_possession_nonce": "Microsoft.AzureSphere.Certificates.retrieveProofOfPossessionNonce", "azure.mgmt.spheredpg.AzureSphereClient.deployments.get": "Microsoft.AzureSphere.Deployments.get", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.list_by_device_group": "Microsoft.AzureSphere.Deployments.listByDeviceGroup", "azure.mgmt.spheredpg.AzureSphereClient.deployments.begin_create_or_update": "Microsoft.AzureSphere.Deployments.createOrUpdate", "azure.mgmt.spheredpg.AzureSphereClient.deployments.begin_delete": "Microsoft.AzureSphere.Deployments.delete", + "azure.mgmt.spheredpg.AzureSphereClient.deployments.list_by_device_group": "Microsoft.AzureSphere.Deployments.listByDeviceGroup", "azure.mgmt.spheredpg.AzureSphereClient.devices.get": "Microsoft.AzureSphere.Devices.get", "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_create_or_update": "Microsoft.AzureSphere.Devices.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.devices.list_by_device_group": "Microsoft.AzureSphere.Devices.listByDeviceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_delete": "Microsoft.AzureSphere.Devices.delete", "azure.mgmt.spheredpg.AzureSphereClient.devices.update": "Microsoft.AzureSphere.Devices.update", - "azure.mgmt.spheredpg.AzureSphereClient.devices.generate_capability_image": "Microsoft.AzureSphere.Devices.generateCapabilityImage", - "azure.mgmt.spheredpg.AzureSphereClient.products.list_by_catalog": "Azure.ResourceManager.Products.listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.products.get": "Microsoft.AzureSphere.Products.get", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_create_or_update": "Microsoft.AzureSphere.Products.createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_delete": "Microsoft.AzureSphere.Products.delete", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_update": "Microsoft.AzureSphere.Products.update", - "azure.mgmt.spheredpg.AzureSphereClient.products.generate_default_device_groups": "Microsoft.AzureSphere.Products.generateDefaultDeviceGroups", - "azure.mgmt.spheredpg.AzureSphereClient.products.count_devices": "Microsoft.AzureSphere.Products.countDevices" + "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_delete": "Microsoft.AzureSphere.Devices.delete", + "azure.mgmt.spheredpg.AzureSphereClient.devices.list_by_device_group": "Microsoft.AzureSphere.Devices.listByDeviceGroup", + "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_generate_capability_image": "Microsoft.AzureSphere.Devices.generateCapabilityImage" } } \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py index c832ff8c050..c9dca361e7a 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py @@ -19,7 +19,6 @@ from .operations import ( CatalogsOperations, CertificatesOperations, - CustomUpdateOperationsOperations, DeploymentsOperations, DeviceGroupsOperations, DevicesOperations, @@ -38,32 +37,28 @@ class AzureSphereClient: # pylint: disable=client-accepts-api-version-keyword,t :ivar operations: Operations operations :vartype operations: azure.mgmt.spheredpg.operations.Operations - :ivar custom_update_operations: CustomUpdateOperationsOperations operations - :vartype custom_update_operations: - azure.mgmt.spheredpg.operations.CustomUpdateOperationsOperations :ivar catalogs: CatalogsOperations operations :vartype catalogs: azure.mgmt.spheredpg.operations.CatalogsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.spheredpg.operations.CertificatesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.spheredpg.operations.ImagesOperations + :ivar products: ProductsOperations operations + :vartype products: azure.mgmt.spheredpg.operations.ProductsOperations :ivar device_groups: DeviceGroupsOperations operations :vartype device_groups: azure.mgmt.spheredpg.operations.DeviceGroupsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.spheredpg.operations.CertificatesOperations :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.spheredpg.operations.DeploymentsOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.spheredpg.operations.DevicesOperations - :ivar products: ProductsOperations operations - :vartype products: azure.mgmt.spheredpg.operations.ProductsOperations :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. 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 - "2022-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-04-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. @@ -101,16 +96,13 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.custom_update_operations = CustomUpdateOperationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.catalogs = CatalogsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize) self.device_groups = DeviceGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.products = ProductsOperations(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/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py index eeabd380351..d7f93c9e28f 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py @@ -28,14 +28,13 @@ class AzureSphereClientConfiguration: # pylint: disable=too-many-instance-attri :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: The API version to use for this operation. Default value is - "2022-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-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py index 420fc219a4a..676ea35869a 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py @@ -19,7 +19,6 @@ from .operations import ( CatalogsOperations, CertificatesOperations, - CustomUpdateOperationsOperations, DeploymentsOperations, DeviceGroupsOperations, DevicesOperations, @@ -38,32 +37,28 @@ class AzureSphereClient: # pylint: disable=client-accepts-api-version-keyword,t :ivar operations: Operations operations :vartype operations: azure.mgmt.spheredpg.aio.operations.Operations - :ivar custom_update_operations: CustomUpdateOperationsOperations operations - :vartype custom_update_operations: - azure.mgmt.spheredpg.aio.operations.CustomUpdateOperationsOperations :ivar catalogs: CatalogsOperations operations :vartype catalogs: azure.mgmt.spheredpg.aio.operations.CatalogsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.spheredpg.aio.operations.CertificatesOperations :ivar images: ImagesOperations operations :vartype images: azure.mgmt.spheredpg.aio.operations.ImagesOperations + :ivar products: ProductsOperations operations + :vartype products: azure.mgmt.spheredpg.aio.operations.ProductsOperations :ivar device_groups: DeviceGroupsOperations operations :vartype device_groups: azure.mgmt.spheredpg.aio.operations.DeviceGroupsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.spheredpg.aio.operations.CertificatesOperations :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.spheredpg.aio.operations.DeploymentsOperations :ivar devices: DevicesOperations operations :vartype devices: azure.mgmt.spheredpg.aio.operations.DevicesOperations - :ivar products: ProductsOperations operations - :vartype products: azure.mgmt.spheredpg.aio.operations.ProductsOperations :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. 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 - "2022-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-04-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. @@ -101,16 +96,13 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.custom_update_operations = CustomUpdateOperationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.catalogs = CatalogsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize) self.device_groups = DeviceGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.products = ProductsOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py index dc70360cd62..08d89f19252 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py @@ -28,14 +28,13 @@ class AzureSphereClientConfiguration: # pylint: disable=too-many-instance-attri :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: The API version to use for this operation. Default value is - "2022-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-04-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2024-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/__init__.py index 868f22c85ea..c05eeb4ce12 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/__init__.py @@ -7,14 +7,13 @@ # -------------------------------------------------------------------------- from ._operations import Operations -from ._operations import CustomUpdateOperationsOperations from ._operations import CatalogsOperations +from ._operations import CertificatesOperations from ._operations import ImagesOperations +from ._operations import ProductsOperations from ._operations import DeviceGroupsOperations -from ._operations import CertificatesOperations from ._operations import DeploymentsOperations from ._operations import DevicesOperations -from ._operations import ProductsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -22,14 +21,13 @@ __all__ = [ "Operations", - "CustomUpdateOperationsOperations", "CatalogsOperations", + "CertificatesOperations", "ImagesOperations", + "ProductsOperations", "DeviceGroupsOperations", - "CertificatesOperations", "DeploymentsOperations", "DevicesOperations", - "ProductsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py index f16d2281802..7b86f22f589 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py @@ -44,6 +44,7 @@ build_catalogs_list_device_insights_request, build_catalogs_list_devices_request, build_catalogs_update_request, + build_catalogs_upload_image_request, build_certificates_get_request, build_certificates_list_by_catalog_request, build_certificates_retrieve_cert_chain_request, @@ -119,8 +120,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: # response body for status code(s): 200 response == { - "actionType": "str", # Optional. Enum. Indicates the action type. "Internal" - refers to actions that are for internal only APIs. "Internal" + "actionType": "str", # Optional. Extensible enum. Indicates the action type. + "Internal" refers to actions that are for internal only APIs. "Internal" "display": { "description": "str", # Optional. The short, localized friendly description of the operation; suitable for tool tips and detailed views. @@ -213,24 +214,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class CustomUpdateOperationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`custom_update_operations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - class CatalogsOperations: """ .. warning:: @@ -267,17 +250,16 @@ async def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -297,7 +279,9 @@ async def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -448,17 +432,16 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -478,22 +461,23 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -513,7 +497,9 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -550,17 +536,16 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -580,7 +565,9 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -617,17 +604,16 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -647,7 +633,9 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -680,17 +668,16 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -710,22 +697,23 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -745,7 +733,9 @@ async def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -832,17 +822,16 @@ async def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -862,7 +851,9 @@ async def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -898,17 +889,16 @@ async def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -928,7 +918,9 @@ async def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -964,17 +956,16 @@ async def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -994,7 +985,9 @@ async def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -1033,17 +1026,16 @@ async def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1063,7 +1055,9 @@ async def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -1238,17 +1232,16 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1268,7 +1261,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -1354,17 +1349,16 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Catalog" # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1384,7 +1378,9 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Catalog" }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -1458,7 +1454,7 @@ async def get_next(next_link=None): @distributed_trace_async async def count_devices( self, resource_group_name: str, catalog_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: + ) -> _models.CountDevicesResponse: """Counts devices in catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1466,8 +1462,8 @@ async def count_devices( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -1489,7 +1485,7 @@ async def count_devices( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) _request = build_catalogs_count_devices_request( resource_group_name=resource_group_name, @@ -1518,7 +1514,7 @@ async def count_devices( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1526,7 +1522,7 @@ async def count_devices( return deserialized # type: ignore @distributed_trace - def list_device_insights( + def list_deployments( self, resource_group_name: str, catalog_name: str, @@ -1535,8 +1531,9 @@ def list_device_insights( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.DeviceInsight"]: - """Lists device insights for catalog. + ) -> AsyncIterable["_models.Deployment"]: + # pylint: disable=line-too-long + """Lists deployments for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1549,8 +1546,8 @@ def list_device_insights( :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of DeviceInsight - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceInsight] + :return: An iterator like instance of Deployment + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -1558,22 +1555,97 @@ def list_device_insights( # response body for status code(s): 200 response == { - "description": "str", # Event description. Required. - "deviceId": "str", # Device ID. Required. - "endTimestampUtc": "2020-02-20 00:00:00", # Event end timestamp. Required. - "eventCategory": "str", # Event category. Required. - "eventClass": "str", # Event class. Required. - "eventCount": 0, # Event count. Required. - "eventType": "str", # Event type. Required. - "startTimestampUtc": "2020-02-20 00:00:00" # Event start timestamp. - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -1586,7 +1658,7 @@ def list_device_insights( def prepare_request(next_link=None): if not next_link: - _request = build_catalogs_list_device_insights_request( + _request = build_catalogs_list_deployments_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -1619,7 +1691,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceInsight], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Deployment], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1644,60 +1716,71 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list_devices( + @overload + def list_device_groups( self, resource_group_name: str, catalog_name: str, + body: _models.ListDeviceGroupsRequest, *, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.Device"]: + ) -> AsyncIterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Lists devices for catalog. + """List the device groups for the catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str + :param body: List device groups for catalog. Required. + :type body: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of Device - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Device] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "deviceGroupName": "str" # Optional. Device Group name. + } + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1714,111 +1797,46 @@ def list_devices( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_catalogs_list_devices_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Device], 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]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _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 - def list_deployments( + @overload + def list_device_groups( self, resource_group_name: str, catalog_name: str, + body: JSON, *, filter: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.Deployment"]: + ) -> AsyncIterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Lists deployments for catalog. + """List the device groups for the catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str + :param body: List device groups for catalog. Required. + :type body: JSON :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of Deployment - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Deployment] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -1826,74 +1844,25 @@ def list_deployments( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1910,136 +1879,56 @@ def list_deployments( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + @overload + def list_device_groups( + self, + resource_group_name: str, + catalog_name: str, + body: IO[bytes], + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.DeviceGroup"]: + # pylint: disable=line-too-long + """List the device groups for the catalog. - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param body: List device groups for catalog. Required. + :type body: IO[bytes] + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: - def prepare_request(next_link=None): - if not next_link: - - _request = build_catalogs_list_deployments_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Deployment], 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]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - def list_device_groups( - self, - resource_group_name: str, - catalog_name: str, - parameters: _models.ListDeviceGroupsRequest, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: - # pylint: disable=line-too-long - """List the device groups for the catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - parameters = { - "deviceGroupName": "str" # Optional. Device Group name. - } + Example: + .. code-block:: python # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -2072,173 +1961,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } - } - """ - - @overload - def list_device_groups( - self, - resource_group_name: str, - catalog_name: str, - parameters: JSON, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: - # pylint: disable=line-too-long - """List the device groups for the catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: JSON - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - - @overload - def list_device_groups( - self, - resource_group_name: str, - catalog_name: str, - parameters: IO[bytes], - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: - # pylint: disable=line-too-long - """List the device groups for the catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: IO[bytes] - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. + "type": "str" # Optional. The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } } """ @@ -2247,7 +1972,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: Union[_models.ListDeviceGroupsRequest, JSON, IO[bytes]], + body: Union[_models.ListDeviceGroupsRequest, JSON, IO[bytes]], *, filter: Optional[str] = None, top: Optional[int] = None, @@ -2262,9 +1987,9 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Is one of the following types: + :param body: List device groups for catalog. Is one of the following types: ListDeviceGroupsRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest or JSON or IO[bytes] + :type body: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest or JSON or IO[bytes] :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. @@ -2279,18 +2004,15 @@ def list_device_groups( .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { + body = { "deviceGroupName": "str" # Optional. Device Group name. } # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -2323,7 +2045,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2342,10 +2066,10 @@ def list_device_groups( error_map.update(kwargs.pop("error_map", {}) or {}) content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore def prepare_request(next_link=None): if not next_link: @@ -2410,38 +2134,32 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class ImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`images` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: - # pylint: disable=line-too-long - """Get a Image. + @distributed_trace + def list_device_insights( + self, + resource_group_name: str, + catalog_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeviceInsight"]: + """Lists device insights for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :return: Image. The Image is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Image + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of DeviceInsight + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceInsight] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -2449,51 +2167,23 @@ async def get(self, resource_group_name: str, catalog_name: str, image_name: str # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + "description": "str", # Event description. Required. + "deviceId": "str", # Device ID. Required. + "endTimestampUtc": "2020-02-20 00:00:00", # Event end timestamp. Required. + "eventCategory": "str", # Event category. Required. + "eventClass": "str", # Event class. Required. + "eventCount": 0, # Event count. Required. + "eventType": "str", # Event type. Required. + "startTimestampUtc": "2020-02-20 00:00:00" # Event start timestamp. Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2502,48 +2192,69 @@ async def get(self, resource_group_name: str, catalog_name: str, image_name: str } 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[_models.Image] = kwargs.pop("cls", None) + _request = build_catalogs_list_device_insights_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_images_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceInsight], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + async def get_next(next_link=None): + _request = prepare_request(next_link) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Image, response.json()) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized # type: ignore + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_by_catalog( + def list_devices( self, resource_group_name: str, catalog_name: str, @@ -2552,9 +2263,9 @@ def list_by_catalog( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.Image"]: + ) -> AsyncIterable["_models.Device"]: # pylint: disable=line-too-long - """List Image resources by Catalog. + """Lists devices for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2567,8 +2278,8 @@ def list_by_catalog( :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of Image - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Image] + :return: An iterator like instance of Device + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -2576,32 +2287,23 @@ def list_by_catalog( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2618,14 +2320,16 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -2638,7 +2342,7 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - _request = build_images_list_by_catalog_request( + _request = build_catalogs_list_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -2671,7 +2375,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Image], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2696,14 +2400,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - image_name: str, - resource: Union[_models.Image, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: + async def _upload_image_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, body: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2716,19 +2415,18 @@ async def _create_or_update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_images_create_or_update_request( + _request = build_catalogs_upload_image_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - image_name=image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -2745,7 +2443,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [202]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -2753,61 +2451,47 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, response_headers) # type: ignore @overload - async def begin_create_or_update( + async def begin_upload_image( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: _models.Image, + body: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: + ) -> AsyncLROPoller[None]: # pylint: disable=line-too-long - """Create a Image. + """Creates an image. Use this action when the image ID is unknown. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Image + :param body: Image upload request body. Required. + :type body: ~azure.mgmt.spheredpg.models.Image :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 Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + body = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. "description": "str", # Optional. The image description. @@ -2844,99 +2528,93 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def begin_create_or_update( + async def begin_upload_image( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: JSON, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - # pylint: disable=line-too-long - """Create a Image. + ) -> AsyncLROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON + :param body: Image upload request body. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param body: Image upload request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_upload_image( + self, resource_group_name: str, catalog_name: str, body: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + # pylint: disable=line-too-long + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param body: Image upload request body. Is one of the following types: Image, JSON, IO[bytes] + Required. + :type body: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + body = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. "description": "str", # Optional. The image description. @@ -2973,72 +2651,110 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - catalog_name: str, - image_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + 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._upload_image_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s + :attr:`certificates` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any + ) -> _models.Certificate: # pylint: disable=line-too-long - """Create a Image. + """Get a Certificate. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_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 Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "certificate": "str", # Optional. The certificate as a UTF-8 encoded + base 64 string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate + expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate + not before date. "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. + "status": "str", # Optional. The certificate status. Known values + are: "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3055,115 +2771,110 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace_async - async def begin_create_or_update( + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + + _request = build_certificates_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + serial_number=serial_number, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Certificate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_catalog( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: Union[_models.Image, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: + ) -> AsyncIterable["_models.Certificate"]: # pylint: disable=line-too-long - """Create a Image. + """List Certificate resources by Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Is one of the following types: Image, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Certificate + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "certificate": "str", # Optional. The certificate as a UTF-8 encoded + base 64 string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate + expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate + not before date. "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. + "status": "str", # Optional. The certificate status. Known values + are: "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3180,58 +2891,17 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _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.Image] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Image, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Image].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Image]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3240,337 +2910,353 @@ async def _delete_initial( # 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_certificates_list_by_catalog_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_images_delete_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Certificate], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200, 202, 204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + async def get_next(next_link=None): + _request = prepare_request(next_link) - 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")) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _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_async - async def begin_delete( - self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Image. + async def retrieve_cert_chain( + self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any + ) -> _models.CertificateChainResponse: + """Retrieves cert chain. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :return: CertificateChainResponse. The CertificateChainResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CertificateChainResponse :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "certificateChain": "str" # Optional. The certificate chain. + } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = 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( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _request = build_certificates_retrieve_cert_chain_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + serial_number=serial_number, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _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 -class DeviceGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`device_groups` attribute. - """ + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CertificateChainResponse, response.json()) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - @distributed_trace - def list_by_product( + return deserialized # type: ignore + + @overload + async def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - product_name: str, + serial_number: str, + body: _models.ProofOfPossessionNonceRequest, *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values - and cannot be used for product name. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. + } + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + @overload + async def retrieve_proof_of_possession_nonce( + self, + resource_group_name: str, + catalog_name: str, + serial_number: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProofOfPossessionNonceResponse: + # pylint: disable=line-too-long + """Gets the proof of possession nonce. - _request = build_device_groups_list_by_product_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :raises ~azure.core.exceptions.HttpResponseError: - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + Example: + .. code-block:: python - async def get_next(next_link=None): - _request = prepare_request(next_link) + # response body for status code(s): 200 + response == { + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. + } + """ - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + @overload + async def retrieve_proof_of_possession_nonce( + self, + resource_group_name: str, + catalog_name: str, + serial_number: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProofOfPossessionNonceResponse: + # pylint: disable=line-too-long + """Gets the proof of possession nonce. - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :raises ~azure.core.exceptions.HttpResponseError: - return pipeline_response + Example: + .. code-block:: python - return AsyncItemPaged(get_next, extract_data) + # response body for status code(s): 200 + response == { + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. + } + """ @distributed_trace_async - async def get( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.DeviceGroup: + async def retrieve_proof_of_possession_nonce( + self, + resource_group_name: str, + catalog_name: str, + serial_number: str, + body: Union[_models.ProofOfPossessionNonceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.DeviceGroup + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Is one of the following types: + ProofOfPossessionNonceRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest or JSON or IO[bytes] + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. + } + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -3581,18 +3267,27 @@ async 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.DeviceGroup] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProofOfPossessionNonceResponse] = kwargs.pop("cls", None) - _request = build_device_groups_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificates_retrieve_proof_of_possession_nonce_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + serial_number=serial_number, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -3615,48 +3310,177 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DeviceGroup, response.json()) + deserialized = _deserialize(_models.ProofOfPossessionNonceResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - resource: Union[_models.DeviceGroup, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - 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 + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s + :attr:`images` attribute. + """ - _request = build_device_groups_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: + # pylint: disable=line-too-long + """Get a Image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :return: Image. The Image is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Image + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + + _request = build_images_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Image, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + image_name: str, + resource: Union[_models.Image, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = 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_images_create_or_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -3699,34 +3523,30 @@ async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - resource: _models.DeviceGroup, + image_name: str, + resource: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Image]: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup + :type resource: ~azure.mgmt.spheredpg.models.Image :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 DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -3734,28 +3554,29 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3772,33 +3593,36 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3815,7 +3639,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -3824,63 +3650,60 @@ async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, + image_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Image]: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_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 DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + Example: .. code-block:: python # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3897,7 +3720,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -3906,34 +3731,30 @@ async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, + image_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Image]: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_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 DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -3941,28 +3762,29 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -3979,7 +3801,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -3988,30 +3812,26 @@ async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - resource: Union[_models.DeviceGroup, JSON, IO[bytes]], + image_name: str, + resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Image]: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Is one of the following types: DeviceGroup, JSON, + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Is one of the following types: Image, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :type resource: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Image. The Image is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -4019,28 +3839,29 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4057,33 +3878,36 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4100,14 +3924,16 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _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.DeviceGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.Image] = 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) @@ -4115,8 +3941,7 @@ async def begin_create_or_update( raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + image_name=image_name, resource=resource, content_type=content_type, cls=lambda x, y, z: x, @@ -4128,7 +3953,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.DeviceGroup, response.json()) + deserialized = _deserialize(_models.Image, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4140,18 +3965,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( + return AsyncLROPoller[_models.Image].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.DeviceGroup]( + return AsyncLROPoller[_models.Image]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -4166,11 +3991,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_device_groups_delete_request( + _request = build_images_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + image_name=image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -4202,20 +4026,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Delete a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -4231,8 +4052,7 @@ async def begin_delete( raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + image_name=image_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -4259,93 +4079,184 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( + @distributed_trace + def list_by_catalog( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> Optional[JSON]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + ) -> AsyncIterable["_models.Image"]: + # pylint: disable=line-too-long + """List Image resources by Catalog. - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Image + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: - 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 + Example: + .. code-block:: python - _request = build_device_groups_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) - response = pipeline_response.http_response + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - if response.status_code not in [200, 202]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def prepare_request(next_link=None): + if not next_link: - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) + _request = build_images_list_by_catalog_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - 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")) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return _request - return deserialized # type: ignore + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Image], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - @overload - async def begin_update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - properties: _models.DeviceGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + 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]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ProductsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s + :attr:`products` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> _models.Product: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4354,61 +4265,23 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate - :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 DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: Product. The Product is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Product :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - } - } - - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4425,25 +4298,143 @@ async def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - async def begin_update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: - # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Product] = kwargs.pop("cls", None) + + _request = build_products_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Product, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + resource: Union[_models.Product, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = 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_products_create_or_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(JSON, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + resource: _models.Product, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4452,45 +4443,60 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Product :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 DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4507,25 +4513,26 @@ async def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - properties: IO[bytes], + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Product]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4534,45 +4541,29 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_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. + :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 DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4589,23 +4580,26 @@ async def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @distributed_trace_async - async def begin_update( + @overload + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + resource: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DeviceGroup]: + ) -> AsyncLROPoller[_models.Product]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4614,59 +4608,123 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DeviceGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: + :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 Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + resource: Union[_models.Product, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param resource: Resource create parameters. Is one of the following types: Product, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Product or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - } + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4683,24 +4741,25 @@ async def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _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.DeviceGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.Product] = 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( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, - properties=properties, + resource=resource, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -4711,7 +4770,7 @@ async def begin_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.DeviceGroup, response.json()) + deserialized = _deserialize(_models.Product, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4723,44 +4782,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( + return AsyncLROPoller[_models.Product].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.DeviceGroup]( + return AsyncLROPoller[_models.Product]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def count_devices( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: - """Counts devices in device group. '.default' and '.unassigned' are system defined values and - cannot be used for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "value": 0 # Number of children resources in parent resource. Required. - } - """ + async def _update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Optional[JSON]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4769,61 +4808,74 @@ async def count_devices( } 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.CountDeviceResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[JSON]] = 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_device_groups_count_devices_request( + _request = build_products_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await 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 response.status_code not in [200, 202]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + 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")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def claim_devices( # pylint: disable=inconsistent-return-statements + async def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: _models.ClaimDevicesRequest, + properties: _models.ProductUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4832,76 +4884,139 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - claim_devices_request = { - "deviceIdentifiers": [ - "str" # Device identifiers of the devices to be claimed. Required. - ] + properties = { + "properties": { + "description": "str" # Optional. Description of the product. + } } - """ - - @overload - async def claim_devices( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - claim_devices_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_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 Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } """ @overload - async def claim_devices( # pylint: disable=inconsistent-return-statements + async def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: IO[bytes], + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4910,30 +5025,63 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: IO[bytes] + :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: None - :rtype: None + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } """ @distributed_trace_async - async def claim_devices( # pylint: disable=inconsistent-return-statements + async def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], + properties: Union[_models.ProductUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> AsyncLROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4942,26 +5090,104 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Is one of the following types: - ClaimDevicesRequest, JSON, IO[bytes] Required. - :type claim_devices_request: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest or JSON or - IO[bytes] - :return: None - :rtype: None + :param properties: The resource properties to be updated. Is one of the following types: + ProductUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - claim_devices_request = { - "deviceIdentifiers": [ - "str" # Device identifiers of the devices to be claimed. Required. - ] + properties = { + "properties": { + "description": "str" # Optional. Description of the product. + } + } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _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.Product] = 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, + catalog_name=catalog_name, + product_name=product_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Product, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Product].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Product]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4970,28 +5196,17 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements } 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[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(claim_devices_request, (IOBase, bytes)): - _content = claim_devices_request - else: - _content = json.dumps(claim_devices_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_device_groups_claim_devices_request( + _request = build_products_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -5004,7 +5219,7 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -5012,167 +5227,83 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`certificates` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( - self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any - ) -> _models.Certificate: - # pylint: disable=line-too-long - """Get a Certificate. + async def begin_delete( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name'. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :return: Certificate. The Certificate is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Certificate + :param product_name: Name of product. Required. + :type product_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded - base 64 string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate - expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate - not before date. - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values - are: "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - - _request = build_certificates_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - serial_number=serial_number, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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 + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - if _stream: - deserialized = response.iter_bytes() + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: - deserialized = _deserialize(_models.Certificate, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_catalog( - self, - resource_group_name: str, - catalog_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - **kwargs: Any - ) -> AsyncIterable["_models.Certificate"]: + self, resource_group_name: str, catalog_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Product"]: # pylint: disable=line-too-long - """List Certificate resources by Catalog. + """List Product resources by Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Certificate - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Certificate] + :return: An iterator like instance of Product + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5180,26 +5311,14 @@ def list_by_catalog( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded - base 64 string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate - expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate - not before date. - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values - are: "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5216,14 +5335,15 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -5236,14 +5356,10 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - _request = build_certificates_list_by_catalog_request( + _request = build_products_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5269,7 +5385,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Certificate], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Product], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -5295,22 +5411,21 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def retrieve_cert_chain( - self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any - ) -> _models.CertificateChainResponse: - """Retrieves cert chain. + async def count_devices( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> _models.CountDevicesResponse: + """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be + used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :return: CertificateChainResponse. The CertificateChainResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CertificateChainResponse + :param product_name: Name of product. Required. + :type product_name: str + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5318,7 +5433,7 @@ async def retrieve_cert_chain( # response body for status code(s): 200 response == { - "certificateChain": "str" # Optional. The certificate chain. + "value": 0 # Number of children resources in parent resource. Required. } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -5332,12 +5447,12 @@ async def retrieve_cert_chain( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) - _request = build_certificates_retrieve_cert_chain_request( + _request = build_products_count_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - serial_number=serial_number, + product_name=product_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5362,100 +5477,185 @@ async def retrieve_cert_chain( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CertificateChainResponse, response.json()) + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: _models.ProofOfPossessionNonceRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + @distributed_trace + def generate_default_device_groups( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Generates default device groups for the product. '.default' and '.unassigned' are system + defined values and cannot be used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :param product_name: Name of product. Required. + :type product_name: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - parameters = { - "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. - } - # response body for status code(s): 200 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_products_generate_default_device_groups_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceGroup], 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]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DeviceGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s + :attr:`device_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> _models.DeviceGroup: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: DeviceGroup. The DeviceGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.DeviceGroup :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5463,215 +5663,386 @@ async def retrieve_proof_of_possession_nonce( # response body for status code(s): 200 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + + _request = build_device_groups_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeviceGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: Union[_models.DeviceGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = 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_device_groups_create_or_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(JSON, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - async def retrieve_proof_of_possession_nonce( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - serial_number: str, - parameters: IO[bytes], + product_name: str, + device_group_name: str, + resource: _models.DeviceGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + + # response body for status code(s): 200, 201 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @distributed_trace_async - async def retrieve_proof_of_possession_nonce( + @overload + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - serial_number: str, - parameters: Union[_models.ProofOfPossessionNonceRequest, JSON, IO[bytes]], + product_name: str, + device_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Is one of the following types: - ProofOfPossessionNonceRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest or JSON or - IO[bytes] - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_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 DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - parameters = { - "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. - } - - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProofOfPossessionNonceResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_certificates_retrieve_proof_of_possession_nonce_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - serial_number=serial_number, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProofOfPossessionNonceResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`deployments` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( + @overload + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> _models.Deployment: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - product or device group name. + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5682,86 +6053,40 @@ async def get( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Deployment - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + :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 DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5778,75 +6103,25 @@ async def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - - _request = build_deployments_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Deployment, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized # type: ignore - - @distributed_trace - def list_by_device_group( + @distributed_trace_async + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, + resource: Union[_models.DeviceGroup, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncIterable["_models.Deployment"]: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined - values and cannot be used for product or device group name. + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5857,89 +6132,38 @@ def list_by_device_group( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Deployment - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Deployment] + :param resource: Resource create parameters. Is one of the following types: DeviceGroup, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5956,96 +6180,109 @@ def list_by_device_group( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_deployments_list_by_device_group_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - return _request + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Deployment], deserialized["value"]) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeviceGroup, response.json()) 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) + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + return AsyncLROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _create_or_update_initial( + async def _update_initial( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, - resource: Union[_models.Deployment, JSON, IO[bytes]], + properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> JSON: + ) -> Optional[JSON]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6058,21 +6295,20 @@ async def _create_or_update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(properties, (IOBase, bytes)): + _content = properties else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_deployments_create_or_update_request( + _request = build_device_groups_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -6089,42 +6325,41 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None response_headers = {} if response.status_code == 200: deserialized = _deserialize(JSON, response.json()) - if response.status_code == 201: + 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 = _deserialize(JSON, response.json()) - if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, - resource: _models.Deployment, + properties: _models.DeviceGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Deployment]: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6136,92 +6371,137 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Deployment + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate :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 Deployment. The Deployment is compatible + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + properties = { + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + } + } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_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 DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6238,79 +6518,71 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } + """ - # response body for status code(s): 200, 201 + @overload + async def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_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 DeviceGroup. The DeviceGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6327,25 +6599,24 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @overload - async def begin_create_or_update( + @distributed_trace_async + async def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, - resource: JSON, - *, - content_type: str = "application/json", + properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Deployment]: + ) -> AsyncLROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6357,92 +6628,54 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_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 Deployment. The Deployment is compatible + :param properties: The resource properties to be updated. Is one of the following types: + DeviceGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6459,25 +6692,113 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - deployment_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Deployment]: - # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceGroup] = 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, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeviceGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeviceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_device_groups_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _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")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -6489,126 +6810,64 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_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 Deployment. The Deployment is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] + :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 {} - Example: - .. code-block:: python + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def begin_create_or_update( + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_product( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - deployment_name: str, - resource: Union[_models.Deployment, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.Deployment]: + ) -> AsyncIterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values + and cannot be used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6617,181 +6876,40 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Is one of the following types: Deployment, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Deployment or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible - with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6808,64 +6926,94 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _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.Deployment] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - deployment_name=deployment_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Deployment, response.json()) + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_device_groups_list_by_product_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Deployment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + 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 ) - return AsyncLROPoller[_models.Deployment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response - async def _delete_initial( # pylint: disable=inconsistent-return-statements + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _claim_devices_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + body: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -6876,19 +7024,28 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } 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 {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_deployments_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_device_groups_claim_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6901,7 +7058,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -6909,25 +7066,136 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore + @overload + async def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: _models.ClaimDevicesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest + :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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "deviceIdentifiers": [ + "str" # Device identifiers of the devices to be claimed. Required. + ] + } + """ + + @overload + async def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete( + async def begin_claim_devices( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + body: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6938,27 +7206,39 @@ async def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str + :param body: Bulk claim devices request body. Is one of the following types: + ClaimDevicesRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "deviceIdentifiers": [ + "str" # Device identifiers of the devices to be claimed. Required. + ] + } """ - _headers = kwargs.pop("headers", {}) 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[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._claim_devices_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, + body=body, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -6985,15 +7265,92 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace_async + async def count_devices( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> _models.CountDevicesResponse: + """Counts devices in device group. '.default' and '.unassigned' are system defined values and + cannot be used for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "value": 0 # Number of children resources in parent resource. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) + + _request = build_device_groups_count_devices_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore -class DevicesOperations: + +class DeploymentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`devices` attribute. + :attr:`deployments` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -7010,12 +7367,12 @@ async def get( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any - ) -> _models.Device: + ) -> _models.Deployment: # pylint: disable=line-too-long - """Get a Device. Use '.unassigned' or '.default' for the device group and product names when a - device does not belong to a device group and product. + """Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7026,10 +7383,11 @@ async def get( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7037,23 +7395,68 @@ async def get( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7073,7 +7476,9 @@ async def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -7087,14 +7492,14 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - _request = build_devices_get_request( + _request = build_deployments_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7119,7 +7524,7 @@ async def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(_models.Deployment, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7132,8 +7537,8 @@ async def _create_or_update_initial( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: Union[_models.Device, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any ) -> JSON: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -7157,12 +7562,12 @@ async def _create_or_update_initial( else: _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_devices_create_or_update_request( + _request = build_deployments_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -7207,15 +7612,15 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: _models.Device, + deployment_name: str, + resource: _models.Deployment, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: + ) -> AsyncLROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7226,16 +7631,17 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Device + :type resource: ~azure.mgmt.spheredpg.models.Deployment :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 Device. The Device is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] + :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7243,23 +7649,68 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7279,28 +7730,75 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7320,7 +7818,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -7331,15 +7831,15 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: + ) -> AsyncLROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7350,16 +7850,17 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_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 Device. The Device is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] + :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7367,23 +7868,68 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7403,7 +7949,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -7414,15 +7962,15 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: + ) -> AsyncLROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7433,16 +7981,17 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_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 Device. The Device is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] + :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7450,23 +7999,68 @@ async def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7486,7 +8080,9 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -7497,13 +8093,13 @@ async def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: Union[_models.Device, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Device]: + ) -> AsyncLROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7514,14 +8110,15 @@ async def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param resource: Resource create parameters. Is one of the following types: Device, JSON, + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str + :param resource: Resource create parameters. Is one of the following types: Deployment, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Device or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] + :type resource: ~azure.mgmt.spheredpg.models.Deployment or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Deployment. The Deployment is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -7529,23 +8126,68 @@ async def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7565,28 +8207,75 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -7606,14 +8295,16 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _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.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = 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) @@ -7623,176 +8314,39 @@ async def begin_create_or_update( catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Device, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Device].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Device]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_device_group( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Device"]: - # pylint: disable=line-too-long - """List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values - and cannot be used for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: An iterator like instance of Device - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Device] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_devices_list_by_device_group_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Device], 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]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deployment_name=deployment_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Deployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Deployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Deployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -7800,7 +8354,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -7816,12 +8370,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_devices_delete_request( + _request = build_deployments_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7858,10 +8412,11 @@ async def begin_delete( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete a Device. + """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7872,239 +8427,69 @@ async def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_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( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - device_name=device_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - device_name: str, - properties: _models.DeviceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Device: - # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "deviceGroupId": "str" # Optional. Device group id. - } - } - - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - - @overload - async def update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - device_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Device: - # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param device_name: Device name. Required. - :type device_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: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def update( + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + deployment_name=deployment_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_device_group( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - properties: IO[bytes], *, - content_type: str = "application/json", + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> _models.Device: + ) -> AsyncIterable["_models.Deployment"]: # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. + """List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined + values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8115,39 +8500,83 @@ async def update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_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: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Deployment + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8167,24 +8596,119 @@ async def update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_by_device_group_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Deployment], 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]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DevicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s + :attr:`devices` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def update( + async def get( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.Device: # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. + """Get a Device. Use '.unassigned' or '.default' for the device group and product names when a + device does not belong to a device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8197,31 +8721,18 @@ async def update( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DeviceUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] :return: Device. The Device is compatible with MutableMapping :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "deviceGroupId": "str" # Optional. Device group id. - } - } + .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "chipSku": "str", # Optional. SKU of the chip. "deviceId": "str", # Optional. Device ID. @@ -8252,7 +8763,9 @@ async def update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -8263,20 +8776,80 @@ async def update( } error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + + _request = build_devices_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + resource: Union[_models.Device, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_devices_update_request( + _request = build_devices_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -8291,14 +8864,14 @@ async def update( ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await 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]: + if response.status_code not in [200, 201]: if _stream: await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -8307,18 +8880,12 @@ async def update( response_headers = {} if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(JSON, response.json()) - if response.status_code == 202: + if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(JSON, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8326,21 +8893,21 @@ async def update( return deserialized # type: ignore @overload - async def generate_capability_image( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: _models.GenerateCapabilityImageRequest, + resource: _models.Device, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> AsyncLROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8353,49 +8920,116 @@ async def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Device :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "capabilities": [ - "str" # List of capabilities to create. Required. - ] + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def generate_capability_image( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: JSON, + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> AsyncLROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8408,42 +9042,76 @@ async def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: JSON + :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: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def generate_capability_image( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: IO[bytes], + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> AsyncLROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8456,40 +9124,74 @@ async def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: IO[bytes] + :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: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @distributed_trace_async - async def generate_capability_image( + async def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], + resource: Union[_models.Device, JSON, IO[bytes]], **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> AsyncLROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8502,148 +9204,73 @@ async def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Is one of the following types: - GenerateCapabilityImageRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or - IO[bytes] - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :param resource: Resource create parameters. Is one of the following types: Device, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Device or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "capabilities": [ - "str" # List of capabilities to create. Required. - ] - } - - # response body for status code(s): 200, 202 - response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SignedCapabilityImageResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_devices_generate_capability_image_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - device_name=device_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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, 202]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) - - if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - -class ProductsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.aio.AzureSphereClient`'s - :attr:`products` attribute. - """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_catalog( - self, resource_group_name: str, catalog_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Product"]: - # pylint: disable=line-too-long - """List Product resources by Catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :return: An iterator like instance of Product - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8663,86 +9290,75 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_products_list_by_catalog_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Product], 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) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Device, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Device].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Device]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace_async - async def get( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> _models.Product: + @overload + async def update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + properties: _models.DeviceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Device: # pylint: disable=line-too-long - """Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8751,23 +9367,45 @@ async def get( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :return: Product. The Product is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Product + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "deviceGroupId": "str" # Optional. Device group id. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8787,141 +9425,28 @@ async def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Product] = kwargs.pop("cls", None) - - _request = build_products_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Product, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - resource: Union[_models.Product, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = 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_products_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore @overload - async def begin_create_or_update( + async def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: _models.Product, + device_group_name: str, + device_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8930,61 +9455,38 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Product + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_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 Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :paramtype content_type: str + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9004,24 +9506,28 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - async def begin_create_or_update( + async def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: JSON, + device_group_name: str, + device_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9030,29 +9536,38 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_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 Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9072,24 +9587,26 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @overload - async def begin_create_or_update( + @distributed_trace_async + async def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", + device_group_name: str, + device_name: str, + properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9098,29 +9615,43 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_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 Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Is one of the following types: + DeviceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "deviceGroupId": "str" # Optional. Device group id. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9140,22 +9671,149 @@ async def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Device] = 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_devices_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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, 202]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_devices_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _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")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def begin_create_or_update( + async def begin_delete( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: Union[_models.Product, JSON, IO[bytes]], + device_group_name: str, + device_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[None]: + """Delete a Device. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9164,96 +9822,28 @@ async def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Is one of the following types: Product, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Product or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } """ - _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.Product] = kwargs.pop("cls", None) + 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._create_or_update_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - resource=resource, - content_type=content_type, + device_group_name=device_group_name, + device_name=device_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -9261,12 +9851,9 @@ async def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Product, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -9275,19 +9862,83 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Product].from_continuation_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[_models.Product]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_device_group( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Device"]: + # pylint: disable=line-too-long + """List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values + and cannot be used for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: An iterator like instance of Device + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.Device] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9296,106 +9947,73 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } 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_products_delete_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + def prepare_request(next_link=None): + if not next_link: - if response.status_code not in [200, 202, 204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _request = build_devices_list_by_device_group_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - 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")) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return _request - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name'. + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_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 {} + async def get_next(next_link=None): + _request = prepare_request(next_link) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return pipeline_response - async def _update_initial( + return AsyncItemPaged(get_next, extract_data) + + async def _generate_capability_image_initial( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + device_group_name: str, + device_name: str, + body: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -9414,15 +10032,17 @@ async def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_products_update_request( + _request = build_devices_generate_capability_image_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -9461,19 +10081,21 @@ async def _update_initial( return deserialized # type: ignore @overload - async def begin_update( + async def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: _models.ProductUpdate, + device_group_name: str, + device_name: str, + body: _models.GenerateCapabilityImageRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9482,73 +10104,54 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest :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 Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of AsyncLROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "description": "str" # Optional. Description of the product. - } + body = { + "capabilities": [ + "str" # List of capabilities to create. Required. + ] } - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @overload - async def begin_update( + async def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: JSON, + device_group_name: str, + device_name: str, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9557,66 +10160,47 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of AsyncLROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @overload - async def begin_update( + async def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: IO[bytes], + device_group_name: str, + device_name: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9625,64 +10209,45 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of AsyncLROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @distributed_trace_async - async def begin_update( + async def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + device_group_name: str, + device_name: str, + body: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> AsyncLROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9691,70 +10256,51 @@ async def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Is one of the following types: - ProductUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Is one of the following types: + GenerateCapabilityImageRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "description": "str" # Optional. Description of the product. - } + body = { + "capabilities": [ + "str" # List of capabilities to create. Required. + ] } - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ _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.Product] = kwargs.pop("cls", None) + cls: ClsType[_models.SignedCapabilityImageResponse] = 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( + raw_result = await self._generate_capability_image_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - properties=properties, + device_group_name=device_group_name, + device_name=device_name, + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -9764,10 +10310,14 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} response = pipeline_response.http_response - deserialized = _deserialize(_models.Product, response.json()) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -9777,222 +10327,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Product].from_continuation_token( + return AsyncLROPoller[_models.SignedCapabilityImageResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Product]( + return AsyncLROPoller[_models.SignedCapabilityImageResponse]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - @distributed_trace - def generate_default_device_groups( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DeviceGroup"]: - # pylint: disable=line-too-long - """Generates default device groups for the product. '.default' and '.unassigned' are system - defined values and cannot be used for product name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_products_generate_default_device_groups_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceGroup], 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]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _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_async - async def count_devices( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: - """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be - used for product name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "value": 0 # Number of children resources in parent resource. Required. - } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) - - _request = build_products_count_devices_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/apiview_mapping_python.json deleted file mode 100644 index c98ca40672b..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/apiview_mapping_python.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "CrossLanguagePackageId": "Microsoft.AzureSphere", - "CrossLanguageDefinitionId": { - "azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState": "Azure.ResourceManager.ArmOperationStatus", - "azure.mgmt.spheredpg.models.ArmResourceBase": "Azure.ResourceManager.Foundations.ArmResourceBase", - "azure.mgmt.spheredpg.models.ArmResource": "Azure.ResourceManager.Foundations.ArmResource", - "azure.mgmt.spheredpg.models.TrackedResourceBase": "Azure.ResourceManager.Foundations.TrackedResourceBase", - "azure.mgmt.spheredpg.models.Catalog": "Microsoft.AzureSphere.Catalog", - "azure.mgmt.spheredpg.models.CatalogListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.CatalogProperties": "Microsoft.AzureSphere.CatalogProperties", - "azure.mgmt.spheredpg.models.CatalogUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.ProxyResourceBase": "Azure.ResourceManager.Foundations.ProxyResourceBase", - "azure.mgmt.spheredpg.models.Certificate": "Microsoft.AzureSphere.Certificate", - "azure.mgmt.spheredpg.models.CertificateChainResponse": "Microsoft.AzureSphere.CertificateChainResponse", - "azure.mgmt.spheredpg.models.CertificateListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.CertificateProperties": "Microsoft.AzureSphere.CertificateProperties", - "azure.mgmt.spheredpg.models.ClaimDevicesRequest": "Microsoft.AzureSphere.ClaimDevicesRequest", - "azure.mgmt.spheredpg.models.CountElementsResponse": "Microsoft.AzureSphere.CountElementsResponse", - "azure.mgmt.spheredpg.models.CountDeviceResponse": "Microsoft.AzureSphere.CountDeviceResponse", - "azure.mgmt.spheredpg.models.Deployment": "Microsoft.AzureSphere.Deployment", - "azure.mgmt.spheredpg.models.DeploymentListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.DeploymentProperties": "Microsoft.AzureSphere.DeploymentProperties", - "azure.mgmt.spheredpg.models.Device": "Microsoft.AzureSphere.Device", - "azure.mgmt.spheredpg.models.DeviceGroup": "Microsoft.AzureSphere.DeviceGroup", - "azure.mgmt.spheredpg.models.DeviceGroupListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.DeviceGroupProperties": "Microsoft.AzureSphere.DeviceGroupProperties", - "azure.mgmt.spheredpg.models.DeviceGroupUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.DeviceGroupUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "azure.mgmt.spheredpg.models.DeviceInsight": "Microsoft.AzureSphere.DeviceInsight", - "azure.mgmt.spheredpg.models.DeviceListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.DeviceProperties": "Microsoft.AzureSphere.DeviceProperties", - "azure.mgmt.spheredpg.models.DeviceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.DeviceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "azure.mgmt.spheredpg.models.ErrorAdditionalInfo": "Azure.ResourceManager.Foundations.ErrorAdditionalInfo", - "azure.mgmt.spheredpg.models.ErrorDetail": "Azure.ResourceManager.Foundations.ErrorDetail", - "azure.mgmt.spheredpg.models.ErrorResponse": "Azure.ResourceManager.ErrorResponse", - "azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest": "Microsoft.AzureSphere.GenerateCapabilityImageRequest", - "azure.mgmt.spheredpg.models.Image": "Microsoft.AzureSphere.Image", - "azure.mgmt.spheredpg.models.ImageListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.ImageProperties": "Microsoft.AzureSphere.ImageProperties", - "azure.mgmt.spheredpg.models.ListDeviceGroupsRequest": "Microsoft.AzureSphere.ListDeviceGroupsRequest", - "azure.mgmt.spheredpg.models.Operation": "Azure.ResourceManager.Foundations.Operation", - "azure.mgmt.spheredpg.models.OperationDisplay": "Azure.ResourceManager.Foundations.OperationDisplay", - "azure.mgmt.spheredpg.models.PagedOperation": "Azure.ResourceManager.Foundations.OperationListResult", - "azure.mgmt.spheredpg.models.Product": "Microsoft.AzureSphere.Product", - "azure.mgmt.spheredpg.models.ProductListResult": "Azure.ResourceManager.ResourceListResult", - "azure.mgmt.spheredpg.models.ProductProperties": "Microsoft.AzureSphere.ProductProperties", - "azure.mgmt.spheredpg.models.ProductUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "azure.mgmt.spheredpg.models.ProductUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest": "Microsoft.AzureSphere.ProofOfPossessionNonceRequest", - "azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse": "Microsoft.AzureSphere.ProofOfPossessionNonceResponse", - "azure.mgmt.spheredpg.models.SignedCapabilityImageResponse": "Microsoft.AzureSphere.SignedCapabilityImageResponse", - "azure.mgmt.spheredpg.models.SystemData": "Azure.ResourceManager.Foundations.SystemData", - "azure.mgmt.spheredpg.models.CreatedByType": "Azure.ResourceManager.Foundations.createdByType", - "azure.mgmt.spheredpg.models.ProvisioningState": "Microsoft.AzureSphere.ProvisioningState", - "azure.mgmt.spheredpg.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", - "azure.mgmt.spheredpg.models.OSFeedType": "Microsoft.AzureSphere.OSFeedType", - "azure.mgmt.spheredpg.models.UpdatePolicy": "Microsoft.AzureSphere.UpdatePolicy", - "azure.mgmt.spheredpg.models.AllowCrashDumpCollection": "Microsoft.AzureSphere.AllowCrashDumpCollection", - "azure.mgmt.spheredpg.models.RegionalDataBoundary": "Microsoft.AzureSphere.RegionalDataBoundary", - "azure.mgmt.spheredpg.models.CapabilityType": "Microsoft.AzureSphere.CapabilityType", - "azure.mgmt.spheredpg.models.ImageType": "Microsoft.AzureSphere.ImageType", - "azure.mgmt.spheredpg.models.CertificateStatus": "Microsoft.AzureSphere.CertificateStatus", - "azure.mgmt.spheredpg.models.Origin": "Azure.ResourceManager.Foundations.Origin", - "azure.mgmt.spheredpg.models.ActionType": "Azure.ResourceManager.Foundations.ActionType", - "azure.mgmt.spheredpg.AzureSphereClient.operations.list": "list", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.update": "update", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_resource_group": "listByResourceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_by_subscription": "listBySubscription", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.count_devices": "countDevices", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_insights": "listDeviceInsights", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_devices": "listDevices", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_deployments": "listDeployments", - "azure.mgmt.spheredpg.AzureSphereClient.catalogs.list_device_groups": "listDeviceGroups", - "azure.mgmt.spheredpg.AzureSphereClient.images.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.images.list_by_catalog": "listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.images.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.images.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.list_by_product": "listByProduct", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.begin_update": "update", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.count_devices": "countDevices", - "azure.mgmt.spheredpg.AzureSphereClient.device_groups.claim_devices": "claimDevices", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.list_by_catalog": "listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_cert_chain": "retrieveCertChain", - "azure.mgmt.spheredpg.AzureSphereClient.certificates.retrieve_proof_of_possession_nonce": "retrieveProofOfPossessionNonce", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.list_by_device_group": "listByDeviceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.deployments.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.devices.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.devices.list_by_device_group": "listByDeviceGroup", - "azure.mgmt.spheredpg.AzureSphereClient.devices.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.devices.update": "update", - "azure.mgmt.spheredpg.AzureSphereClient.devices.generate_capability_image": "generateCapabilityImage", - "azure.mgmt.spheredpg.AzureSphereClient.products.list_by_catalog": "listByCatalog", - "azure.mgmt.spheredpg.AzureSphereClient.products.get": "get", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_create_or_update": "createOrUpdate", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_delete": "delete", - "azure.mgmt.spheredpg.AzureSphereClient.products.begin_update": "update", - "azure.mgmt.spheredpg.AzureSphereClient.products.generate_default_device_groups": "generateDefaultDeviceGroups", - "azure.mgmt.spheredpg.AzureSphereClient.products.count_devices": "countDevices" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py index 73e830ed238..35a4fb93890 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py @@ -6,9 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models import ArmOperationStatusResourceProvisioningState -from ._models import ArmResource -from ._models import ArmResourceBase +from ._models import ArmOperationStatus from ._models import Catalog from ._models import CatalogListResult from ._models import CatalogProperties @@ -18,7 +16,7 @@ from ._models import CertificateListResult from ._models import CertificateProperties from ._models import ClaimDevicesRequest -from ._models import CountDeviceResponse +from ._models import CountDevicesResponse from ._models import CountElementsResponse from ._models import Deployment from ._models import DeploymentListResult @@ -44,6 +42,7 @@ from ._models import ListDeviceGroupsRequest from ._models import Operation from ._models import OperationDisplay +from ._models import PagedDeviceInsight from ._models import PagedOperation from ._models import Product from ._models import ProductListResult @@ -52,10 +51,11 @@ from ._models import ProductUpdateProperties from ._models import ProofOfPossessionNonceRequest from ._models import ProofOfPossessionNonceResponse -from ._models import ProxyResourceBase +from ._models import ProxyResource +from ._models import Resource from ._models import SignedCapabilityImageResponse from ._models import SystemData -from ._models import TrackedResourceBase +from ._models import TrackedResource from ._enums import ActionType from ._enums import AllowCrashDumpCollection @@ -74,9 +74,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ArmOperationStatusResourceProvisioningState", - "ArmResource", - "ArmResourceBase", + "ArmOperationStatus", "Catalog", "CatalogListResult", "CatalogProperties", @@ -86,7 +84,7 @@ "CertificateListResult", "CertificateProperties", "ClaimDevicesRequest", - "CountDeviceResponse", + "CountDevicesResponse", "CountElementsResponse", "Deployment", "DeploymentListResult", @@ -112,6 +110,7 @@ "ListDeviceGroupsRequest", "Operation", "OperationDisplay", + "PagedDeviceInsight", "PagedOperation", "Product", "ProductListResult", @@ -120,10 +119,11 @@ "ProductUpdateProperties", "ProofOfPossessionNonceRequest", "ProofOfPossessionNonceResponse", - "ProxyResourceBase", + "ProxyResource", + "Resource", "SignedCapabilityImageResponse", "SystemData", - "TrackedResourceBase", + "TrackedResource", "ActionType", "AllowCrashDumpCollection", "CapabilityType", diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_enums.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_enums.py index df8347d69c3..3964d580f2a 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_enums.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_enums.py @@ -11,7 +11,9 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ INTERNAL = "Internal" """Actions are for internal-only APIs.""" @@ -137,7 +139,7 @@ class OSFeedType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the resource.""" + """Provisioning state of resource.""" SUCCEEDED = "Succeeded" """Resource has been created.""" diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py index be6ced9f961..92ef644147d 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py @@ -18,7 +18,7 @@ from .. import models as _models -class ArmOperationStatusResourceProvisioningState(_model_base.Model): # pylint: disable=name-too-long +class ArmOperationStatus(_model_base.Model): """Standard Azure Resource Manager operation status response. Readonly variables are only populated by the server, and will be ignored when sending a request. @@ -71,42 +71,39 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class ArmResourceBase(_model_base.Model): - """Base class used for type definitions.""" - - -class ArmResource(ArmResourceBase): +class Resource(_model_base.Model): """Common properties for all Azure Resource Manager resources. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.spheredpg.models.SystemData """ - id: str = rest_field(visibility=["read"]) + id: Optional[str] = rest_field(visibility=["read"]) """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required.""" - type: str = rest_field(visibility=["read"]) + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or - \"Microsoft.Storage/storageAccounts\". Required.""" + \"Microsoft.Storage/storageAccounts\".""" system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" -class TrackedResourceBase(ArmResource): - """The resource model definition for an Azure Resource Manager tracked top level resource. +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Readonly variables are only populated by the server, and will be ignored when sending a request. @@ -114,10 +111,11 @@ class TrackedResourceBase(ArmResource): :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -152,7 +150,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Catalog(TrackedResourceBase): +class Catalog(TrackedResource): """An Azure Sphere catalog. Readonly variables are only populated by the server, and will be ignored when sending a request. @@ -161,10 +159,11 @@ class Catalog(TrackedResourceBase): :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -240,11 +239,15 @@ class CatalogProperties(_model_base.Model): Readonly variables are only populated by the server, and will be ignored when sending a request. + :ivar tenant_id: The Azure Sphere tenant ID associated with the catalog. + :vartype tenant_id: str :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". :vartype provisioning_state: str or ~azure.mgmt.spheredpg.models.ProvisioningState """ + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The Azure Sphere tenant ID associated with the catalog.""" provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] ) @@ -280,19 +283,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class ProxyResourceBase(ArmResource): +class ProxyResource(Resource): """The base proxy resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -300,19 +302,18 @@ class ProxyResourceBase(ArmResource): """ -class Certificate(ProxyResourceBase): +class Certificate(ProxyResource): """An certificate resource belonging to a catalog resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -493,7 +494,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class CountDeviceResponse(CountElementsResponse): +class CountDevicesResponse(CountElementsResponse): """Response to the action call for count devices in a catalog. All required parameters must be populated in order to send to server. @@ -520,19 +521,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Deployment(ProxyResourceBase): +class Deployment(ProxyResource): """An deployment resource belonging to a device group resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -646,19 +646,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Device(ProxyResourceBase): +class Device(ProxyResource): """An device resource belonging to a device group resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -688,19 +687,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class DeviceGroup(ProxyResourceBase): +class DeviceGroup(ProxyResource): """An device group resource belonging to a product resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -842,11 +840,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DeviceGroupUpdate(_model_base.Model): """The type used for update operations of the DeviceGroup. - :ivar properties: + :ivar properties: The updatable properties of the DeviceGroup. :vartype properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdateProperties """ properties: Optional["_models.DeviceGroupUpdateProperties"] = rest_field() + """The updatable properties of the DeviceGroup.""" @overload def __init__( @@ -1091,11 +1090,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class DeviceUpdate(_model_base.Model): """The type used for update operations of the Device. - :ivar properties: + :ivar properties: The updatable properties of the Device. :vartype properties: ~azure.mgmt.spheredpg.models.DeviceUpdateProperties """ properties: Optional["_models.DeviceUpdateProperties"] = rest_field() + """The updatable properties of the Device.""" @overload def __init__( @@ -1250,19 +1250,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Image(ProxyResourceBase): +class Image(ProxyResource): """An image resource belonging to a catalog resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -1455,8 +1454,8 @@ class Operation(_model_base.Model): (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", and "user,system". :vartype origin: str or ~azure.mgmt.spheredpg.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" + :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.spheredpg.models.ActionType """ @@ -1474,8 +1473,8 @@ class Operation(_model_base.Model): 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") - """Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only - APIs. \"Internal\"""" + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" @overload def __init__( @@ -1547,6 +1546,41 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class PagedDeviceInsight(_model_base.Model): + """Paged collection of DeviceInsight items. + + All required parameters must be populated in order to send to server. + + :ivar value: The DeviceInsight items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.DeviceInsight] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.DeviceInsight"] = rest_field() + """The DeviceInsight items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.DeviceInsight"], + next_link: Optional[str] = None, + ): ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class PagedOperation(_model_base.Model): """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. @@ -1583,19 +1617,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) -class Product(ProxyResourceBase): +class Product(ProxyResource): """An product resource belonging to a catalog resource. Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - Required. :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". Required. + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. @@ -1665,17 +1698,15 @@ class ProductProperties(_model_base.Model): Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar description: Description of the product. Required. + :ivar description: Description of the product. :vartype description: str :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". :vartype provisioning_state: str or ~azure.mgmt.spheredpg.models.ProvisioningState """ - description: str = rest_field() - """Description of the product. Required.""" + description: Optional[str] = rest_field() + """Description of the product.""" provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] ) @@ -1686,7 +1717,7 @@ class ProductProperties(_model_base.Model): def __init__( self, *, - description: str, + description: Optional[str] = None, ): ... @overload @@ -1703,11 +1734,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class ProductUpdate(_model_base.Model): """The type used for update operations of the Product. - :ivar properties: + :ivar properties: The updatable properties of the Product. :vartype properties: ~azure.mgmt.spheredpg.models.ProductUpdateProperties """ properties: Optional["_models.ProductUpdateProperties"] = rest_field() + """The updatable properties of the Product.""" @overload def __init__( diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/__init__.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/__init__.py index 868f22c85ea..c05eeb4ce12 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/__init__.py @@ -7,14 +7,13 @@ # -------------------------------------------------------------------------- from ._operations import Operations -from ._operations import CustomUpdateOperationsOperations from ._operations import CatalogsOperations +from ._operations import CertificatesOperations from ._operations import ImagesOperations +from ._operations import ProductsOperations from ._operations import DeviceGroupsOperations -from ._operations import CertificatesOperations from ._operations import DeploymentsOperations from ._operations import DevicesOperations -from ._operations import ProductsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -22,14 +21,13 @@ __all__ = [ "Operations", - "CustomUpdateOperationsOperations", "CatalogsOperations", + "CertificatesOperations", "ImagesOperations", + "ProductsOperations", "DeviceGroupsOperations", - "CertificatesOperations", "DeploymentsOperations", "DevicesOperations", - "ProductsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py index ce04e7f28c3..dab1eb134cf 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py @@ -49,7 +49,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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +70,7 @@ def build_catalogs_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +99,7 @@ def build_catalogs_create_or_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +130,7 @@ def build_catalogs_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +160,7 @@ def build_catalogs_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +188,7 @@ def build_catalogs_list_by_resource_group_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -215,7 +215,7 @@ def build_catalogs_list_by_subscription_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -241,7 +241,7 @@ def build_catalogs_count_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -263,7 +263,7 @@ def build_catalogs_count_devices_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_catalogs_list_device_insights_request( # pylint: disable=name-too-long +def build_catalogs_list_deployments_request( resource_group_name: str, catalog_name: str, subscription_id: str, @@ -277,11 +277,11 @@ def build_catalogs_list_device_insights_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -307,7 +307,7 @@ def build_catalogs_list_device_insights_request( # pylint: disable=name-too-lon return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_catalogs_list_devices_request( +def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, subscription_id: str, @@ -321,11 +321,12 @@ def build_catalogs_list_devices_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -346,12 +347,14 @@ def build_catalogs_list_devices_request( _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_catalogs_list_deployments_request( +def build_catalogs_list_device_insights_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, subscription_id: str, @@ -365,11 +368,11 @@ def build_catalogs_list_deployments_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -395,7 +398,7 @@ def build_catalogs_list_deployments_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long +def build_catalogs_list_devices_request( resource_group_name: str, catalog_name: str, subscription_id: str, @@ -409,12 +412,11 @@ def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long _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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -434,6 +436,35 @@ def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long if maxpagesize is not None: _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_catalogs_upload_image_request( + resource_group_name: str, catalog_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-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/uploadImage" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "catalogName": _SERIALIZER.url("catalog_name", catalog_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") @@ -442,22 +473,22 @@ def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_get_request( - resource_group_name: str, catalog_name: str, image_name: str, subscription_id: str, **kwargs: Any +def build_certificates_get_request( + resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), + "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -471,7 +502,7 @@ def build_images_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_list_by_catalog_request( +def build_certificates_list_by_catalog_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, subscription_id: str, @@ -485,11 +516,11 @@ def build_images_list_by_catalog_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -499,6 +530,7 @@ def build_images_list_by_catalog_request( _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if top is not None: @@ -507,6 +539,95 @@ def build_images_list_by_catalog_request( _params["$skip"] = _SERIALIZER.query("skip", skip, "int") if maxpagesize is not None: _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificates_retrieve_cert_chain_request( # pylint: disable=name-too-long + resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), + "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_certificates_retrieve_proof_of_possession_nonce_request( # pylint: disable=name-too-long + resource_group_name: str, catalog_name: str, serial_number: 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-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), + "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_images_get_request( + resource_group_name: str, catalog_name: str, image_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-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), + "imageName": _SERIALIZER.url("image_name", image_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 @@ -522,7 +643,7 @@ def build_images_create_or_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -553,7 +674,7 @@ def build_images_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -576,10 +697,9 @@ def build_images_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_list_by_product_request( # pylint: disable=name-too-long +def build_images_list_by_catalog_request( resource_group_name: str, catalog_name: str, - product_name: str, subscription_id: str, *, filter: Optional[str] = None, @@ -591,21 +711,21 @@ def build_device_groups_list_by_product_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "productName": _SERIALIZER.url("product_name", product_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if top is not None: @@ -614,7 +734,6 @@ def build_device_groups_list_by_product_request( # pylint: disable=name-too-lon _params["$skip"] = _SERIALIZER.query("skip", skip, "int") if maxpagesize is not None: _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -622,28 +741,22 @@ def build_device_groups_list_by_product_request( # pylint: disable=name-too-lon return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_get_request( - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_products_get_request( + resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -657,29 +770,23 @@ def build_device_groups_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_products_create_or_update_request( + resource_group_name: str, catalog_name: str, product_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -695,28 +802,23 @@ def build_device_groups_create_or_update_request( # pylint: disable=name-too-lo return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_delete_request( - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_products_update_request( + resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + 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-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -725,34 +827,29 @@ def build_device_groups_delete_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_update_request( - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_products_delete_request( + resource_group_name: str, catalog_name: str, product_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -761,35 +858,26 @@ def build_device_groups_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_count_devices_request( # pylint: disable=name-too-long - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_products_list_by_catalog_request( + resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -800,32 +888,25 @@ def build_device_groups_count_devices_request( # pylint: disable=name-too-long # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_device_groups_claim_devices_request( # pylint: disable=name-too-long - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - subscription_id: str, - **kwargs: Any +def build_products_count_devices_request( + resource_group_name: str, catalog_name: str, product_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -834,29 +915,27 @@ def build_device_groups_claim_devices_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_certificates_get_request( - resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any +def build_products_generate_default_device_groups_request( # pylint: disable=name-too-long + resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), + "productName": _SERIALIZER.url("product_name", product_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -867,45 +946,36 @@ def build_certificates_get_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_certificates_list_by_catalog_request( # pylint: disable=name-too-long +def build_device_groups_get_request( resource_group_name: str, catalog_name: str, + product_name: str, + device_group_name: str, subscription_id: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - maxpagesize: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), + "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip is not None: - _params["$skip"] = _SERIALIZER.query("skip", skip, "int") - if maxpagesize is not None: - _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -914,22 +984,29 @@ def build_certificates_list_by_catalog_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_certificates_retrieve_cert_chain_request( # pylint: disable=name-too-long - resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any +def build_device_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + catalog_name: str, + product_name: str, + device_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", "2022-09-01-preview")) + 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-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), + "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -938,28 +1015,36 @@ def build_certificates_retrieve_cert_chain_request( # pylint: disable=name-too- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_certificates_retrieve_proof_of_possession_nonce_request( # pylint: disable=name-too-long - resource_group_name: str, catalog_name: str, serial_number: str, subscription_id: str, **kwargs: Any +def build_device_groups_update_request( + resource_group_name: str, + catalog_name: str, + product_name: str, + device_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 {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "serialNumber": _SERIALIZER.url("serial_number", serial_number, "str"), + "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -972,33 +1057,31 @@ def build_certificates_retrieve_proof_of_possession_nonce_request( # pylint: di _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_get_request( +def build_device_groups_delete_request( resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1009,14 +1092,13 @@ def build_deployments_get_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_list_by_device_group_request( # pylint: disable=name-too-long +def build_device_groups_list_by_product_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, subscription_id: str, *, filter: Optional[str] = None, @@ -1028,22 +1110,22 @@ def build_deployments_list_by_device_group_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), - "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if top is not None: @@ -1052,7 +1134,6 @@ def build_deployments_list_by_device_group_request( # pylint: disable=name-too- _params["$skip"] = _SERIALIZER.query("skip", skip, "int") if maxpagesize is not None: _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1060,12 +1141,11 @@ def build_deployments_list_by_device_group_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_create_or_update_request( # pylint: disable=name-too-long +def build_device_groups_claim_devices_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -1073,18 +1153,17 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1097,33 +1176,31 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _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) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_delete_request( +def build_device_groups_count_devices_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1134,33 +1211,33 @@ def build_deployments_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_get_request( +def build_deployments_get_request( resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1174,12 +1251,12 @@ def build_devices_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_create_or_update_request( +def build_deployments_create_or_update_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -1187,18 +1264,18 @@ def build_devices_create_or_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1214,28 +1291,30 @@ def build_devices_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_list_by_device_group_request( # pylint: disable=name-too-long +def build_deployments_delete_request( resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, + deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1246,47 +1325,58 @@ def build_devices_list_by_device_group_request( # pylint: disable=name-too-long # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_delete_request( +def build_deployments_list_by_device_group_request( # pylint: disable=name-too-long resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + maxpagesize: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), - "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if maxpagesize is not None: + _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_update_request( +def build_devices_get_request( resource_group_name: str, catalog_name: str, product_name: str, @@ -1298,8 +1388,7 @@ def build_devices_update_request( _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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1319,14 +1408,12 @@ def build_devices_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_devices_generate_capability_image_request( # pylint: disable=name-too-long +def build_devices_create_or_update_request( resource_group_name: str, catalog_name: str, product_name: str, @@ -1339,11 +1426,11 @@ def build_devices_generate_capability_image_request( # pylint: disable=name-too _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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1363,53 +1450,34 @@ def build_devices_generate_capability_image_request( # pylint: disable=name-too _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_products_list_by_catalog_request( - resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "catalogName": _SERIALIZER.url("catalog_name", catalog_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) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_get_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any +def build_devices_update_request( + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + 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-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1418,28 +1486,37 @@ def build_products_get_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_create_or_update_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any +def build_devices_delete_request( + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1448,29 +1525,33 @@ def build_products_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_delete_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any +def build_devices_list_by_device_group_request( # pylint: disable=name-too-long + resource_group_name: str, + catalog_name: str, + product_name: str, + device_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1481,26 +1562,34 @@ def build_products_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_update_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any +def build_devices_generate_capability_image_request( # pylint: disable=name-too-long + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage" # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), "productName": _SERIALIZER.url("product_name", product_name, "str"), + "deviceGroupName": _SERIALIZER.url("device_group_name", device_group_name, "str"), + "deviceName": _SERIALIZER.url("device_name", device_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1513,76 +1602,18 @@ def build_products_update_request( _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) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_products_generate_default_device_groups_request( # pylint: disable=name-too-long - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "productName": _SERIALIZER.url("product_name", product_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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_products_count_devices_request( - resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices" # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "catalogName": _SERIALIZER.url("catalog_name", catalog_name, "str"), - "productName": _SERIALIZER.url("product_name", product_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="POST", 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.spheredpg.AzureSphereClient`'s - :attr:`operations` attribute. - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`operations` attribute. + """ def __init__(self, *args, **kwargs): input_args = list(args) @@ -1605,8 +1636,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: # response body for status code(s): 200 response == { - "actionType": "str", # Optional. Enum. Indicates the action type. "Internal" - refers to actions that are for internal only APIs. "Internal" + "actionType": "str", # Optional. Extensible enum. Indicates the action type. + "Internal" refers to actions that are for internal only APIs. "Internal" "display": { "description": "str", # Optional. The short, localized friendly description of the operation; suitable for tool tips and detailed views. @@ -1699,24 +1730,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class CustomUpdateOperationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`custom_update_operations` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - class CatalogsOperations: """ .. warning:: @@ -1753,17 +1766,16 @@ def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _mo # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1783,7 +1795,9 @@ def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _mo }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -1934,17 +1948,16 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1964,22 +1977,23 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -1999,7 +2013,9 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2036,17 +2052,16 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2066,7 +2081,9 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2103,17 +2120,16 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2133,7 +2149,9 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2166,17 +2184,16 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2196,22 +2213,23 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2231,7 +2249,9 @@ def begin_create_or_update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2318,17 +2338,16 @@ def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2348,7 +2367,9 @@ def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2384,17 +2405,16 @@ def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2414,7 +2434,9 @@ def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2450,17 +2472,16 @@ def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2480,7 +2501,9 @@ def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -2519,17 +2542,16 @@ def update( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2549,7 +2571,9 @@ def update( }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -2724,17 +2748,16 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2754,7 +2777,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -2840,17 +2865,16 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Catalog"]: # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. "location": "str", # The geo-location where the resource lives. Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "provisioningState": "str" # Optional. The status of the last + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "tenantId": "str" # Optional. The Azure Sphere tenant ID associated + with the catalog. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -2870,7 +2894,9 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Catalog"]: }, "tags": { "str": "str" # Optional. Resource tags. - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -2942,7 +2968,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _models.CountDeviceResponse: + def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _models.CountDevicesResponse: """Counts devices in catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2950,8 +2976,8 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -2973,7 +2999,7 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) _request = build_catalogs_count_devices_request( resource_group_name=resource_group_name, @@ -3002,7 +3028,7 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3010,7 +3036,7 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A return deserialized # type: ignore @distributed_trace - def list_device_insights( + def list_deployments( self, resource_group_name: str, catalog_name: str, @@ -3019,8 +3045,9 @@ def list_device_insights( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.DeviceInsight"]: - """Lists device insights for catalog. + ) -> Iterable["_models.Deployment"]: + # pylint: disable=line-too-long + """Lists deployments for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3033,8 +3060,8 @@ def list_device_insights( :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of DeviceInsight - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceInsight] + :return: An iterator like instance of Deployment + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -3042,290 +3069,16 @@ def list_device_insights( # response body for status code(s): 200 response == { - "description": "str", # Event description. Required. - "deviceId": "str", # Device ID. Required. - "endTimestampUtc": "2020-02-20 00:00:00", # Event end timestamp. Required. - "eventCategory": "str", # Event category. Required. - "eventClass": "str", # Event class. Required. - "eventCount": 0, # Event count. Required. - "eventType": "str", # Event type. Required. - "startTimestampUtc": "2020-02-20 00:00:00" # Event start timestamp. - Required. - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_catalogs_list_device_insights_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceInsight], 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]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _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 - def list_devices( - self, - resource_group_name: str, - catalog_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.Device"]: - # pylint: disable=line-too-long - """Lists devices for catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Device - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Device] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_catalogs_list_devices_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Device], 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]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _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 - def list_deployments( - self, - resource_group_name: str, - catalog_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.Deployment"]: - # pylint: disable=line-too-long - """Lists deployments for catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Deployment - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Deployment] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "deployedImages": [ { - "id": "str", # Fully qualified resource ID for the - resource. Ex - + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. @@ -3369,7 +3122,10 @@ def list_deployments( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". } ], "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment @@ -3394,7 +3150,9 @@ def list_deployments( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} @@ -3477,7 +3235,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: _models.ListDeviceGroupsRequest, + body: _models.ListDeviceGroupsRequest, *, filter: Optional[str] = None, top: Optional[int] = None, @@ -3493,8 +3251,8 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest + :param body: List device groups for catalog. Required. + :type body: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. @@ -3512,18 +3270,15 @@ def list_device_groups( .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { + body = { "deviceGroupName": "str" # Optional. Device Group name. } # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -3556,7 +3311,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -3565,7 +3322,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: JSON, + body: JSON, *, filter: Optional[str] = None, top: Optional[int] = None, @@ -3581,8 +3338,8 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: JSON + :param body: List device groups for catalog. Required. + :type body: JSON :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. @@ -3601,12 +3358,9 @@ def list_device_groups( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -3639,7 +3393,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -3648,7 +3404,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: IO[bytes], + body: IO[bytes], *, filter: Optional[str] = None, top: Optional[int] = None, @@ -3664,8 +3420,8 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Required. - :type parameters: IO[bytes] + :param body: List device groups for catalog. Required. + :type body: IO[bytes] :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. @@ -3684,12 +3440,9 @@ def list_device_groups( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -3722,7 +3475,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -3731,7 +3486,7 @@ def list_device_groups( self, resource_group_name: str, catalog_name: str, - parameters: Union[_models.ListDeviceGroupsRequest, JSON, IO[bytes]], + body: Union[_models.ListDeviceGroupsRequest, JSON, IO[bytes]], *, filter: Optional[str] = None, top: Optional[int] = None, @@ -3746,9 +3501,9 @@ def list_device_groups( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param parameters: List device groups for catalog. Is one of the following types: + :param body: List device groups for catalog. Is one of the following types: ListDeviceGroupsRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest or JSON or IO[bytes] + :type body: ~azure.mgmt.spheredpg.models.ListDeviceGroupsRequest or JSON or IO[bytes] :keyword filter: Filter the result list using the given expression. Default value is None. :paramtype filter: str :keyword top: The number of result items to return. Default value is None. @@ -3763,18 +3518,15 @@ def list_device_groups( .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { + body = { "deviceGroupName": "str" # Optional. Device Group name. } # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "allowCrashDumpsCollection": "str", # Optional. Flag to define if the user allows for crash dump collection. Known values are: "Enabled" and @@ -3807,7 +3559,9 @@ def list_device_groups( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3826,10 +3580,10 @@ def list_device_groups( error_map.update(kwargs.pop("error_map", {}) or {}) content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore def prepare_request(next_link=None): if not next_link: @@ -3894,38 +3648,32 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class ImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`images` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: - # pylint: disable=line-too-long - """Get a Image. + def list_device_insights( + self, + resource_group_name: str, + catalog_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.DeviceInsight"]: + """Lists device insights for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :return: Image. The Image is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Image + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of DeviceInsight + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceInsight] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -3933,51 +3681,23 @@ def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kw # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + "description": "str", # Event description. Required. + "deviceId": "str", # Device ID. Required. + "endTimestampUtc": "2020-02-20 00:00:00", # Event end timestamp. Required. + "eventCategory": "str", # Event category. Required. + "eventClass": "str", # Event class. Required. + "eventCount": 0, # Event count. Required. + "eventType": "str", # Event type. Required. + "startTimestampUtc": "2020-02-20 00:00:00" # Event start timestamp. Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3986,48 +3706,69 @@ def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kw } 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[_models.Image] = kwargs.pop("cls", None) + _request = build_catalogs_list_device_insights_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_images_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceInsight], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Image, response.json()) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_catalog( + def list_devices( self, resource_group_name: str, catalog_name: str, @@ -4036,9 +3777,9 @@ def list_by_catalog( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.Image"]: + ) -> Iterable["_models.Device"]: # pylint: disable=line-too-long - """List Image resources by Catalog. + """Lists devices for catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4051,8 +3792,8 @@ def list_by_catalog( :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. :paramtype skip: int - :return: An iterator like instance of Image - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Image] + :return: An iterator like instance of Device + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -4060,32 +3801,23 @@ def list_by_catalog( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4102,14 +3834,16 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -4122,7 +3856,7 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - _request = build_images_list_by_catalog_request( + _request = build_catalogs_list_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, @@ -4155,7 +3889,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Image], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -4180,14 +3914,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - image_name: str, - resource: Union[_models.Image, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: + def _upload_image_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, body: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4200,19 +3929,18 @@ def _create_or_update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_images_create_or_update_request( + _request = build_catalogs_upload_image_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - image_name=image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -4229,7 +3957,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [202]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -4237,61 +3965,47 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, response_headers) # type: ignore @overload - def begin_create_or_update( + def begin_upload_image( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: _models.Image, + body: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Image]: + ) -> LROPoller[None]: # pylint: disable=line-too-long - """Create a Image. + """Creates an image. Use this action when the image ID is unknown. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Image + :param body: Image upload request body. Required. + :type body: ~azure.mgmt.spheredpg.models.Image :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 Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + body = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. "description": "str", # Optional. The image description. @@ -4328,99 +4042,93 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def begin_create_or_update( + def begin_upload_image( self, resource_group_name: str, catalog_name: str, - image_name: str, - resource: JSON, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Image]: - # pylint: disable=line-too-long - """Create a Image. + ) -> LROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON + :param body: Image upload request body. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_upload_image( + self, + resource_group_name: str, + catalog_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param body: Image upload request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_upload_image( + self, resource_group_name: str, catalog_name: str, body: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + # pylint: disable=line-too-long + """Creates an image. Use this action when the image ID is unknown. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param body: Image upload request body. Is one of the following types: Image, JSON, IO[bytes] + Required. + :type body: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + body = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "componentId": "str", # Optional. The image component id. "description": "str", # Optional. The image description. @@ -4457,72 +4165,110 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - @overload - def begin_create_or_update( - self, - resource_group_name: str, - catalog_name: str, - image_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Image]: + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + 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._upload_image_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class CertificatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`certificates` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any + ) -> _models.Certificate: # pylint: disable=line-too-long - """Create a Image. + """Get a Certificate. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_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 Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :return: Certificate. The Certificate is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "certificate": "str", # Optional. The certificate as a UTF-8 encoded + base 64 string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate + expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate + not before date. "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. + "status": "str", # Optional. The certificate status. Known values + are: "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4539,115 +4285,110 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - catalog_name: str, - image_name: str, - resource: Union[_models.Image, JSON, IO[bytes]], + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + + _request = build_certificates_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + serial_number=serial_number, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Certificate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_catalog( + self, + resource_group_name: str, + catalog_name: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> LROPoller[_models.Image]: + ) -> Iterable["_models.Certificate"]: # pylint: disable=line-too-long - """Create a Image. + """List Certificate resources by Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :param resource: Resource create parameters. Is one of the following types: Image, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] - :return: An instance of LROPoller that returns Image. The Image is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Certificate + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "componentId": "str", # Optional. The image component id. - "description": "str", # Optional. The image description. - "image": "str", # Optional. Image as a UTF-8 encoded base 64 string - on image create. This field contains the image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image type. Known values are: - "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", - "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", - "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", - "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", - "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "certificate": "str", # Optional. The certificate as a UTF-8 encoded + base 64 string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate + expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate + not before date. "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for an image. Known values are: "None" and "EU". - "uri": "str" # Optional. Location the image. + "status": "str", # Optional. The certificate status. Known values + are: "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -4664,58 +4405,17 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _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.Image] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Image, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Image].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Image]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4724,337 +4424,353 @@ def _delete_initial( # 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_certificates_list_by_catalog_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_images_delete_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Certificate], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200, 202, 204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - 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")) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _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 - def begin_delete( - self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Image. + def retrieve_cert_chain( + self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any + ) -> _models.CertificateChainResponse: + """Retrieves cert chain. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param image_name: Image name. Use .default for image creation. Required. - :type image_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :return: CertificateChainResponse. The CertificateChainResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CertificateChainResponse :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "certificateChain": "str" # Optional. The certificate chain. + } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = 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( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - image_name=image_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _request = build_certificates_retrieve_cert_chain_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + serial_number=serial_number, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _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 -class DeviceGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`device_groups` attribute. - """ + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CertificateChainResponse, response.json()) - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - @distributed_trace - def list_by_product( + return deserialized # type: ignore + + @overload + def retrieve_proof_of_possession_nonce( self, resource_group_name: str, catalog_name: str, - product_name: str, + serial_number: str, + body: _models.ProofOfPossessionNonceRequest, *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, + content_type: str = "application/json", **kwargs: Any - ) -> Iterable["_models.DeviceGroup"]: + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values - and cannot be used for product name. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. + } + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + @overload + def retrieve_proof_of_possession_nonce( + self, + resource_group_name: str, + catalog_name: str, + serial_number: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProofOfPossessionNonceResponse: + # pylint: disable=line-too-long + """Gets the proof of possession nonce. - _request = build_device_groups_list_by_product_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :raises ~azure.core.exceptions.HttpResponseError: - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + Example: + .. code-block:: python - def get_next(next_link=None): - _request = prepare_request(next_link) + # response body for status code(s): 200 + response == { + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. + } + """ - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + @overload + def retrieve_proof_of_possession_nonce( + self, + resource_group_name: str, + catalog_name: str, + serial_number: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProofOfPossessionNonceResponse: + # pylint: disable=line-too-long + """Gets the proof of possession nonce. - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :raises ~azure.core.exceptions.HttpResponseError: - return pipeline_response + Example: + .. code-block:: python - return ItemPaged(get_next, extract_data) + # response body for status code(s): 200 + response == { + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. + } + """ @distributed_trace - def get( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.DeviceGroup: + def retrieve_proof_of_possession_nonce( + self, + resource_group_name: str, + catalog_name: str, + serial_number: str, + body: Union[_models.ProofOfPossessionNonceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ProofOfPossessionNonceResponse: # pylint: disable=line-too-long - """Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Gets the proof of possession nonce. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.DeviceGroup + :param serial_number: Serial number of the certificate. Use '.default' to get current active + certificate. Required. + :type serial_number: str + :param body: Proof of possession nonce request body. Is one of the following types: + ProofOfPossessionNonceRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest or JSON or IO[bytes] + :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. + } + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 + string. + "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. + "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not + before date. + "provisioningState": "str", # Optional. The status of the last operation. + Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", + "Deleting", and "Accepted". + "status": "str", # Optional. The certificate status. Known values are: + "Active", "Inactive", "Expired", and "Revoked". + "subject": "str", # Optional. The certificate subject. + "thumbprint": "str" # Optional. The certificate thumbprint. } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -5065,18 +4781,27 @@ 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.DeviceGroup] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProofOfPossessionNonceResponse] = kwargs.pop("cls", None) - _request = build_device_groups_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_certificates_retrieve_proof_of_possession_nonce_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + serial_number=serial_number, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -5099,48 +4824,177 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.DeviceGroup, response.json()) + deserialized = _deserialize(_models.ProofOfPossessionNonceResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - resource: Union[_models.DeviceGroup, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - 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 + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`images` attribute. + """ - _request = build_device_groups_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any) -> _models.Image: + # pylint: disable=line-too-long + """Get a Image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :return: Image. The Image is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Image + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + + _request = build_images_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Image, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + image_name: str, + resource: Union[_models.Image, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = 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_images_create_or_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + image_name=image_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -5183,34 +5037,30 @@ def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - resource: _models.DeviceGroup, + image_name: str, + resource: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Image]: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup + :type resource: ~azure.mgmt.spheredpg.models.Image :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 DeviceGroup. The DeviceGroup is compatible with + :return: An instance of LROPoller that returns Image. The Image is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5218,28 +5068,29 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5256,33 +5107,36 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5299,7 +5153,9 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -5308,34 +5164,30 @@ def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, + image_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Image]: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_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 DeviceGroup. The DeviceGroup is compatible with + :return: An instance of LROPoller that returns Image. The Image is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5343,28 +5195,29 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5381,7 +5234,9 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -5390,34 +5245,30 @@ def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, + image_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Image]: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_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 DeviceGroup. The DeviceGroup is compatible with + :return: An instance of LROPoller that returns Image. The Image is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5425,28 +5276,29 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5463,7 +5315,9 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -5472,30 +5326,26 @@ def begin_create_or_update( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - resource: Union[_models.DeviceGroup, JSON, IO[bytes]], + image_name: str, + resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Image]: # pylint: disable=line-too-long - """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param resource: Resource create parameters. Is one of the following types: DeviceGroup, JSON, + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str + :param resource: Resource create parameters. Is one of the following types: Image, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup or JSON or IO[bytes] - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + :type resource: ~azure.mgmt.spheredpg.models.Image or JSON or IO[bytes] + :return: An instance of LROPoller that returns Image. The Image is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Image] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -5503,28 +5353,29 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5541,33 +5392,36 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5584,14 +5438,16 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _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.DeviceGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.Image] = 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) @@ -5599,8 +5455,7 @@ def begin_create_or_update( raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + image_name=image_name, resource=resource, content_type=content_type, cls=lambda x, y, z: x, @@ -5612,7 +5467,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.DeviceGroup, response.json()) + deserialized = _deserialize(_models.Image, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5624,18 +5479,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.DeviceGroup].from_continuation_token( + return LROPoller[_models.Image].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.DeviceGroup]( + return LROPoller[_models.Image]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -5650,11 +5505,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_device_groups_delete_request( + _request = build_images_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + image_name=image_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5686,20 +5540,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Delete a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str + :param image_name: Image name. Use an image GUID for GA versions of the API. Required. + :type image_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -5715,8 +5566,7 @@ def begin_delete( raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, + image_name=image_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -5743,93 +5593,182 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _update_initial( + @distributed_trace + def list_by_catalog( self, resource_group_name: str, catalog_name: str, - product_name: str, - device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> Optional[JSON]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + ) -> Iterable["_models.Image"]: + # pylint: disable=line-too-long + """List Image resources by Catalog. - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Image + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: - 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 + Example: + .. code-block:: python - _request = build_device_groups_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image component id. + "description": "str", # Optional. The image description. + "image": "str", # Optional. Image as a UTF-8 encoded base 64 string + on image create. This field contains the image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image type. Known values are: + "InvalidImageType", "OneBl", "PlutonRuntime", "WifiFirmware", + "SecurityMonitor", "NormalWorldLoader", "NormalWorldDtb", + "NormalWorldKernel", "RootFs", "Services", "Applications", "FwConfig", + "BootManifest", "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", "FirmwareUpdateManifest", + "CustomerUpdateManifest", "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for an image. Known values are: "None" and "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) - response = pipeline_response.http_response + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - if response.status_code not in [200, 202]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def prepare_request(next_link=None): + if not next_link: - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) + _request = build_images_list_by_catalog_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - 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")) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return _request - return deserialized # type: ignore + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Image], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - @overload - def begin_update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - properties: _models.DeviceGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + 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]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ProductsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`products` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any) -> _models.Product: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5838,61 +5777,23 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate - :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 DeviceGroup. The DeviceGroup is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :return: Product. The Product is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Product :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - } - } - - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5909,72 +5810,205 @@ def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def begin_update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: - # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_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 DeviceGroup. The DeviceGroup is compatible with + cls: ClsType[_models.Product] = kwargs.pop("cls", None) + + _request = build_products_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Product, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + resource: Union[_models.Product, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[JSON] = 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_products_create_or_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(JSON, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + resource: _models.Product, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Product]: + # pylint: disable=line-too-long + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Product + :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 Product. The Product is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -5991,25 +6025,26 @@ def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - properties: IO[bytes], + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6018,45 +6053,29 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_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. + :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 DeviceGroup. The DeviceGroup is compatible with + :return: An instance of LROPoller that returns Product. The Product is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6073,23 +6092,26 @@ def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @distributed_trace - def begin_update( + @overload + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], + resource: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DeviceGroup]: + ) -> LROPoller[_models.Product]: # pylint: disable=line-too-long - """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6098,59 +6120,123 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DeviceGroupUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + resource: Union[_models.Product, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Product]: + # pylint: disable=line-too-long + """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param resource: Resource create parameters. Is one of the following types: Product, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Product or JSON or IO[bytes] + :return: An instance of LROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - } + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6167,24 +6253,25 @@ def begin_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _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.DeviceGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.Product] = 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( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, - properties=properties, + resource=resource, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -6195,7 +6282,7 @@ def begin_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.DeviceGroup, response.json()) + deserialized = _deserialize(_models.Product, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6207,44 +6294,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.DeviceGroup].from_continuation_token( + return LROPoller[_models.Product].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.DeviceGroup]( + return LROPoller[_models.Product]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def count_devices( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: - """Counts devices in device group. '.default' and '.unassigned' are system defined values and - cannot be used for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "value": 0 # Number of children resources in parent resource. Required. - } - """ + def _update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> Optional[JSON]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6253,61 +6320,74 @@ def count_devices( } 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.CountDeviceResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) - _request = build_device_groups_count_devices_request( + 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_products_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = 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 response.status_code not in [200, 202]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + 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")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def claim_devices( # pylint: disable=inconsistent-return-statements + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: _models.ClaimDevicesRequest, + properties: _models.ProductUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> LROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6316,42 +6396,72 @@ def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of LROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - claim_devices_request = { - "deviceIdentifiers": [ - "str" # Device identifiers of the devices to be claimed. Required. - ] + properties = { + "properties": { + "description": "str" # Optional. Description of the product. + } + } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def claim_devices( # pylint: disable=inconsistent-return-statements + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: JSON, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> LROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6360,32 +6470,65 @@ def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: JSON + :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: None - :rtype: None + :return: An instance of LROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } """ @overload - def claim_devices( # pylint: disable=inconsistent-return-statements + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: IO[bytes], + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> LROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6394,30 +6537,63 @@ def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Required. - :type claim_devices_request: IO[bytes] + :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: None - :rtype: None + :return: An instance of LROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } """ @distributed_trace - def claim_devices( # pylint: disable=inconsistent-return-statements + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - claim_devices_request: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], + properties: Union[_models.ProductUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names - when bulk claiming devices to a catalog only. + ) -> LROPoller[_models.Product]: + # pylint: disable=line-too-long + """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -6426,26 +6602,104 @@ def claim_devices( # pylint: disable=inconsistent-return-statements :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param claim_devices_request: Bulk claim devices request body. Is one of the following types: - ClaimDevicesRequest, JSON, IO[bytes] Required. - :type claim_devices_request: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest or JSON or - IO[bytes] - :return: None - :rtype: None + :param properties: The resource properties to be updated. Is one of the following types: + ProductUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns Product. The Product is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - claim_devices_request = { - "deviceIdentifiers": [ - "str" # Device identifiers of the devices to be claimed. Required. - ] + properties = { + "properties": { + "description": "str" # Optional. Description of the product. + } + } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _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.Product] = 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, + catalog_name=catalog_name, + product_name=product_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Product, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Product].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Product]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6454,28 +6708,17 @@ def claim_devices( # pylint: disable=inconsistent-return-statements } 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[None] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(claim_devices_request, (IOBase, bytes)): - _content = claim_devices_request - else: - _content = json.dumps(claim_devices_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_device_groups_claim_devices_request( + _request = build_products_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - device_group_name=device_group_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6488,7 +6731,7 @@ def claim_devices( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -6496,167 +6739,83 @@ def claim_devices( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore - -class CertificatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`certificates` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get( - self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any - ) -> _models.Certificate: - # pylint: disable=line-too-long - """Get a Certificate. + def begin_delete( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for + product name'. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :return: Certificate. The Certificate is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Certificate + :param product_name: Name of product. Required. + :type product_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 {} - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded - base 64 string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate - expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate - not before date. - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values - are: "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - - _request = build_certificates_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - serial_number=serial_number, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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 + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - if _stream: - deserialized = response.iter_bytes() + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - deserialized = _deserialize(_models.Certificate, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_catalog( - self, - resource_group_name: str, - catalog_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - **kwargs: Any - ) -> Iterable["_models.Certificate"]: + self, resource_group_name: str, catalog_name: str, **kwargs: Any + ) -> Iterable["_models.Product"]: # pylint: disable=line-too-long - """List Certificate resources by Catalog. + """List Product resources by Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Certificate - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Certificate] + :return: An iterator like instance of Product + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Product] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -6664,26 +6823,14 @@ def list_by_catalog( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded - base 64 string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate - expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate - not before date. - "provisioningState": "str", # Optional. The status of the last + "description": "str", # Optional. Description of the product. + "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values - are: "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -6700,14 +6847,15 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -6720,14 +6868,10 @@ def list_by_catalog( def prepare_request(next_link=None): if not next_link: - _request = build_certificates_list_by_catalog_request( + _request = build_products_list_by_catalog_request( resource_group_name=resource_group_name, catalog_name=catalog_name, subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6753,7 +6897,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Certificate], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Product], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6779,22 +6923,21 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def retrieve_cert_chain( - self, resource_group_name: str, catalog_name: str, serial_number: str, **kwargs: Any - ) -> _models.CertificateChainResponse: - """Retrieves cert chain. + def count_devices( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> _models.CountDevicesResponse: + """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be + used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :return: CertificateChainResponse. The CertificateChainResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CertificateChainResponse + :param product_name: Name of product. Required. + :type product_name: str + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -6802,7 +6945,7 @@ def retrieve_cert_chain( # response body for status code(s): 200 response == { - "certificateChain": "str" # Optional. The certificate chain. + "value": 0 # Number of children resources in parent resource. Required. } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -6816,12 +6959,12 @@ def retrieve_cert_chain( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CertificateChainResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) - _request = build_certificates_retrieve_cert_chain_request( + _request = build_products_count_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - serial_number=serial_number, + product_name=product_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6846,152 +6989,185 @@ def retrieve_cert_chain( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.CertificateChainResponse, response.json()) + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: _models.ProofOfPossessionNonceRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + @distributed_trace + def generate_default_device_groups( + self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any + ) -> Iterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Generates default device groups for the product. '.default' and '.unassigned' are system + defined values and cannot be used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :param product_name: Name of product. Required. + :type product_name: str + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - parameters = { - "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. - } - # response body for status code(s): 200 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - } - """ - - @overload - def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: - # pylint: disable=line-too-long - """Gets the proof of possession nonce. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: + cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_products_generate_default_device_groups_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceGroup], 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]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DeviceGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`device_groups` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> _models.DeviceGroup: # pylint: disable=line-too-long - """Gets the proof of possession nonce. + """Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: DeviceGroup. The DeviceGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.DeviceGroup :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -6999,74 +7175,104 @@ def retrieve_proof_of_possession_nonce( # response body for status code(s): 200 response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace - def retrieve_proof_of_possession_nonce( - self, - resource_group_name: str, - catalog_name: str, - serial_number: str, - parameters: Union[_models.ProofOfPossessionNonceRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.ProofOfPossessionNonceResponse: - # pylint: disable=line-too-long - """Gets the proof of possession nonce. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param serial_number: Serial number of the certificate. Use '.default' to get current active - certificate. Required. - :type serial_number: str - :param parameters: Proof of possession nonce request body. Is one of the following types: - ProofOfPossessionNonceRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceRequest or JSON or - IO[bytes] - :return: ProofOfPossessionNonceResponse. The ProofOfPossessionNonceResponse is compatible with - MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.ProofOfPossessionNonceResponse - :raises ~azure.core.exceptions.HttpResponseError: + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) - Example: - .. code-block:: python + _request = build_device_groups_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - # JSON input template you can fill out and use as your body input. - parameters = { - "proofOfPossessionNonce": "str" # The proof of possession nonce. Required. - } + _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: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeviceGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore - # response body for status code(s): 200 - response == { - "certificate": "str", # Optional. The certificate as a UTF-8 encoded base 64 - string. - "expiryUtc": "2020-02-20 00:00:00", # Optional. The certificate expiry date. - "notBeforeUtc": "2020-02-20 00:00:00", # Optional. The certificate not - before date. - "provisioningState": "str", # Optional. The status of the last operation. - Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", - "Deleting", and "Accepted". - "status": "str", # Optional. The certificate status. Known values are: - "Active", "Inactive", "Expired", and "Revoked". - "subject": "str", # Optional. The certificate subject. - "thumbprint": "str" # Optional. The certificate thumbprint. - } - """ + def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: Union[_models.DeviceGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7079,19 +7285,20 @@ def retrieve_proof_of_possession_nonce( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProofOfPossessionNonceResponse] = kwargs.pop("cls", None) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_certificates_retrieve_proof_of_possession_nonce_request( + _request = build_device_groups_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, - serial_number=serial_number, + product_name=product_name, + device_group_name=device_group_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -7101,61 +7308,253 @@ def retrieve_proof_of_possession_nonce( ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = 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 response.status_code not in [200, 201]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.ProofOfPossessionNonceResponse, response.json()) + response_headers = {} + if response.status_code == 200: + deserialized = _deserialize(JSON, response.json()) + + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(JSON, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: _models.DeviceGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup + :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 DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`deployments` attribute. - """ + Example: + .. code-block:: python - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_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 DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ - @distributed_trace - def get( + @overload + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> _models.Deployment: + ) -> LROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - product or device group name. + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7166,86 +7565,40 @@ def get( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Deployment + :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 DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -7262,75 +7615,25 @@ def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - - _request = build_deployments_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - deployment_name=deployment_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Deployment, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore @distributed_trace - def list_by_device_group( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip: Optional[int] = None, + resource: Union[_models.DeviceGroup, JSON, IO[bytes]], **kwargs: Any - ) -> Iterable["_models.Deployment"]: + ) -> LROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined - values and cannot be used for product or device group name. + """Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -7341,89 +7644,80 @@ def list_by_device_group( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :keyword filter: Filter the result list using the given expression. Default value is None. - :paramtype filter: str - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of Deployment - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Deployment] + :param resource: Resource create parameters. Is one of the following types: DeviceGroup, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.DeviceGroup or JSON or IO[bytes] + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + # JSON input template you can fill out and use as your body input. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + + # response body for status code(s): 200, 201 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -7440,96 +7734,67 @@ def list_by_device_group( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_deployments_list_by_device_group_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip=skip, - maxpagesize=maxpagesize, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeviceGroup] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Deployment], deserialized["value"]) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeviceGroup, response.json()) 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) + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _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, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeviceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + return LROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _create_or_update_initial( + def _update_initial( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, - resource: Union[_models.Deployment, JSON, IO[bytes]], + properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> JSON: + ) -> Optional[JSON]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7542,21 +7807,20 @@ def _create_or_update_initial( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource + if isinstance(properties, (IOBase, bytes)): + _content = properties else: - _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_deployments_create_or_update_request( + _request = build_device_groups_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -7573,42 +7837,41 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None response_headers = {} if response.status_code == 200: deserialized = _deserialize(JSON, response.json()) - if response.status_code == 201: + 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 = _deserialize(JSON, response.json()) - if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, - resource: _models.Deployment, + properties: _models.DeviceGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Deployment]: + ) -> LROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -7620,92 +7883,56 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Deployment + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate :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 Deployment. The Deployment is compatible with + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + } + } + + # response body for status code(s): 200, 202 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -7722,79 +7949,71 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } + """ - # response body for status code(s): 200, 201 + @overload + def begin_update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeviceGroup]: + # pylint: disable=line-too-long + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_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 DeviceGroup. The DeviceGroup is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -7811,25 +8030,26 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, - resource: JSON, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Deployment]: + ) -> LROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -7841,92 +8061,40 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + :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 Deployment. The Deployment is compatible with + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -7943,25 +8111,24 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @overload - def begin_create_or_update( + @distributed_trace + def begin_update( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - deployment_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", + device_group_name: str, + properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Deployment]: + ) -> LROPoller[_models.DeviceGroup]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + """Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -7973,92 +8140,54 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_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 Deployment. The Deployment is compatible with + :param properties: The resource properties to be updated. Is one of the following types: + DeviceGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceGroupUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns DeviceGroup. The DeviceGroup is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -8075,24 +8204,182 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _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.DeviceGroup] = 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, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DeviceGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeviceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeviceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_device_groups_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _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")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_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( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def begin_create_or_update( + def list_by_product( self, resource_group_name: str, catalog_name: str, product_name: str, - device_group_name: str, - deployment_name: str, - resource: Union[_models.Deployment, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> LROPoller[_models.Deployment]: + ) -> Iterable["_models.DeviceGroup"]: # pylint: disable=line-too-long - """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values + and cannot be used for product name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8101,181 +8388,40 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str - :param resource: Resource create parameters. Is one of the following types: Deployment, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Deployment or JSON or IO[bytes] - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of DeviceGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "deployedImages": [ - { - "id": "str", # Fully qualified resource ID for the - resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". Required. - "properties": { - "componentId": "str", # Optional. The image - component id. - "description": "str", # Optional. The image - description. - "image": "str", # Optional. Image as a UTF-8 - encoded base 64 string on image create. This field contains the - image URI on image reads. - "imageId": "str", # Optional. Image ID. - "imageName": "str", # Optional. Image name. - "imageType": "str", # Optional. The image - type. Known values are: "InvalidImageType", "OneBl", - "PlutonRuntime", "WifiFirmware", "SecurityMonitor", - "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", - "RootFs", "Services", "Applications", "FwConfig", "BootManifest", - "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", - "UpdateCertStore", "BaseSystemUpdateManifest", - "FirmwareUpdateManifest", "CustomerUpdateManifest", - "RecoveryManifest", "ManifestSet", and "Other". - "provisioningState": "str", # Optional. The - status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and - "Accepted". - "regionalDataBoundary": "str", # Optional. - Regional data boundary for an image. Known values are: "None" and - "EU". - "uri": "str" # Optional. Location the image. - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The - type of identity that created the resource. - "createdBy": "str", # Optional. The identity - that created the resource. - "createdByType": "str", # Optional. The type - of identity that created the resource. Known values are: "User", - "Application", "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. - The timestamp of resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The - identity that last modified the resource. - "lastModifiedByType": "str" # Optional. The - type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - } - } - ], - "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment - date UTC. - "deploymentId": "str", # Optional. Deployment ID. - "provisioningState": "str" # Optional. The status of the last + "allowCrashDumpsCollection": "str", # Optional. Flag to define if + the user allows for crash dump collection. Known values are: "Enabled" and + "Disabled". + "description": "str", # Optional. Description of the device group. + "hasDeployment": bool, # Optional. Deployment status for the device + group. + "osFeedType": "str", # Optional. Operating system feed type of the + device group. Known values are: "Retail" and "RetailEval". + "provisioningState": "str", # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". + "regionalDataBoundary": "str", # Optional. Regional data boundary + for the device group. Known values are: "None" and "EU". + "updatePolicy": "str" # Optional. Update policy of the device group. + Known values are: "UpdateAll" and "No3rdPartyAppUpdates". }, "systemData": { "createdAt": "2020-02-20", # Optional. The type of identity that @@ -8292,64 +8438,94 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - _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.Deployment] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - deployment_name=deployment_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_device_groups_list_by_product_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Deployment, response.json()) + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeviceGroup], deserialized["value"]) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Deployment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + 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 ) - return LROPoller[_models.Deployment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response - def _delete_initial( # pylint: disable=inconsistent-return-statements + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _claim_devices_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + body: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -8360,19 +8536,28 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } 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 {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_deployments_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_device_groups_claim_devices_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8385,7 +8570,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -8393,25 +8578,136 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore + @overload + def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: _models.ClaimDevicesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest + :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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "deviceIdentifiers": [ + "str" # Device identifiers of the devices to be claimed. Required. + ] + } + """ + + @overload + def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_claim_devices( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param body: Bulk claim devices request body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete( + def begin_claim_devices( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - deployment_name: str, + body: Union[_models.ClaimDevicesRequest, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: - """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used - for product or device group name. + """Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names + when bulk claiming devices to a catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8422,27 +8718,39 @@ def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param deployment_name: Deployment name. Use .default for deployment creation and to get the - current deployment for the associated device group. Required. - :type deployment_name: str + :param body: Bulk claim devices request body. Is one of the following types: + ClaimDevicesRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.ClaimDevicesRequest or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "deviceIdentifiers": [ + "str" # Device identifiers of the devices to be claimed. Required. + ] + } """ - _headers = kwargs.pop("headers", {}) 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[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._claim_devices_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - deployment_name=deployment_name, + body=body, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8469,15 +8777,92 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace + def count_devices( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> _models.CountDevicesResponse: + """Counts devices in device group. '.default' and '.unassigned' are system defined values and + cannot be used for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: CountDevicesResponse. The CountDevicesResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.CountDevicesResponse + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "value": 0 # Number of children resources in parent resource. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CountDevicesResponse] = kwargs.pop("cls", None) + + _request = build_device_groups_count_devices_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CountDevicesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore -class DevicesOperations: + return deserialized # type: ignore + + +class DeploymentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`devices` attribute. + :attr:`deployments` attribute. """ def __init__(self, *args, **kwargs): @@ -8494,12 +8879,12 @@ def get( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any - ) -> _models.Device: + ) -> _models.Deployment: # pylint: disable=line-too-long - """Get a Device. Use '.unassigned' or '.default' for the device group and product names when a - device does not belong to a device group and product. + """Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8510,10 +8895,11 @@ def get( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8521,23 +8907,68 @@ def get( # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8557,7 +8988,9 @@ def get( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -8571,14 +9004,14 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - _request = build_devices_get_request( + _request = build_deployments_get_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -8603,7 +9036,7 @@ def get( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(_models.Deployment, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8616,8 +9049,8 @@ def _create_or_update_initial( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: Union[_models.Device, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any ) -> JSON: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -8641,12 +9074,12 @@ def _create_or_update_initial( else: _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_devices_create_or_update_request( + _request = build_deployments_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -8691,15 +9124,15 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: _models.Device, + deployment_name: str, + resource: _models.Deployment, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Device]: + ) -> LROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8710,16 +9143,17 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Device + :type resource: ~azure.mgmt.spheredpg.models.Deployment :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 Device. The Device is compatible with + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8727,23 +9161,68 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8763,28 +9242,75 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8804,7 +9330,9 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -8815,15 +9343,15 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Device]: + ) -> LROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8834,16 +9362,17 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_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 Device. The Device is compatible with + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8851,23 +9380,68 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8887,7 +9461,9 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -8898,15 +9474,15 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Device]: + ) -> LROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8917,16 +9493,17 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_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 Device. The Device is compatible with + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8934,23 +9511,68 @@ def begin_create_or_update( # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -8970,7 +9592,9 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @@ -8981,13 +9605,13 @@ def begin_create_or_update( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - resource: Union[_models.Device, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Device]: + ) -> LROPoller[_models.Deployment]: # pylint: disable=line-too-long - """Create a Device. Use '.unassigned' or '.default' for the device group and product names to - claim a device to the catalog only. + """Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -8998,14 +9622,15 @@ def begin_create_or_update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param resource: Resource create parameters. Is one of the following types: Device, JSON, + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_name: str + :param resource: Resource create parameters. Is one of the following types: Deployment, JSON, IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Device or JSON or IO[bytes] - :return: An instance of LROPoller that returns Device. The Device is compatible with + :type resource: ~azure.mgmt.spheredpg.models.Deployment or JSON or IO[bytes] + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -9013,23 +9638,68 @@ def begin_create_or_update( # JSON input template you can fill out and use as your body input. resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9049,28 +9719,75 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9090,14 +9807,16 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ _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.Device] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = 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) @@ -9107,176 +9826,39 @@ def begin_create_or_update( catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, - resource=resource, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Device, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Device].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Device]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_device_group( - self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> Iterable["_models.Device"]: - # pylint: disable=line-too-long - """List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values - and cannot be used for product or device group name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :return: An iterator like instance of Device - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Device] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_devices_list_by_device_group_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Device], 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]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deployment_name=deployment_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Deployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Deployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Deployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -9284,7 +9866,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -9300,12 +9882,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_devices_delete_request( + _request = build_deployments_delete_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, device_group_name=device_group_name, - device_name=device_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9342,10 +9924,11 @@ def begin_delete( catalog_name: str, product_name: str, device_group_name: str, - device_name: str, + deployment_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete a Device. + """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used + for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9356,239 +9939,69 @@ def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str + :param deployment_name: Deployment name. Use .default for deployment creation and to get the + current deployment for the associated device group. Required. + :type deployment_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( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - device_name=device_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - device_name: str, - properties: _models.DeviceUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Device: - # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param device_name: Device name. Required. - :type device_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "deviceGroupId": "str" # Optional. Device group id. - } - } - - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - - @overload - def update( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - device_group_name: str, - device_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Device: - # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :param device_group_name: Name of device group. Required. - :type device_group_name: str - :param device_name: Device name. Required. - :type device_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: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200, 202 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def update( + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + deployment_name=deployment_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_device_group( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, - device_name: str, - properties: IO[bytes], *, - content_type: str = "application/json", + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, **kwargs: Any - ) -> _models.Device: + ) -> Iterable["_models.Deployment"]: # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. + """List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined + values and cannot be used for product or device group name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9599,39 +10012,83 @@ def update( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :param device_name: Device name. Required. - :type device_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: Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device + :keyword filter: Filter the result list using the given expression. Default value is None. + :paramtype filter: str + :keyword top: The number of result items to return. Default value is None. + :paramtype top: int + :keyword skip: The number of result items to skip. Default value is None. + :paramtype skip: int + :return: An iterator like instance of Deployment + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "chipSku": "str", # Optional. SKU of the chip. - "deviceId": "str", # Optional. Device ID. - "lastAvailableOsVersion": "str", # Optional. OS version available - for installation when update requested. - "lastInstalledOsVersion": "str", # Optional. OS version running on - device when update requested. - "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when - update requested and new OS version available. - "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when - update was last requested. + "deployedImages": [ + { + "id": "str", # Optional. Fully qualified resource ID + for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "componentId": "str", # Optional. The image + component id. + "description": "str", # Optional. The image + description. + "image": "str", # Optional. Image as a UTF-8 + encoded base 64 string on image create. This field contains the + image URI on image reads. + "imageId": "str", # Optional. Image ID. + "imageName": "str", # Optional. Image name. + "imageType": "str", # Optional. The image + type. Known values are: "InvalidImageType", "OneBl", + "PlutonRuntime", "WifiFirmware", "SecurityMonitor", + "NormalWorldLoader", "NormalWorldDtb", "NormalWorldKernel", + "RootFs", "Services", "Applications", "FwConfig", "BootManifest", + "Nwfs", "TrustedKeystore", "Policy", "CustomerBoardConfig", + "UpdateCertStore", "BaseSystemUpdateManifest", + "FirmwareUpdateManifest", "CustomerUpdateManifest", + "RecoveryManifest", "ManifestSet", and "Other". + "provisioningState": "str", # Optional. The + status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and + "Accepted". + "regionalDataBoundary": "str", # Optional. + Regional data boundary for an image. Known values are: "None" and + "EU". + "uri": "str" # Optional. Location the image. + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The + type of identity that created the resource. + "createdBy": "str", # Optional. The identity + that created the resource. + "createdByType": "str", # Optional. The type + of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. + The timestamp of resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The + identity that last modified the resource. + "lastModifiedByType": "str" # Optional. The + type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. + E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + } + ], + "deploymentDateUtc": "2020-02-20 00:00:00", # Optional. Deployment + date UTC. + "deploymentId": "str", # Optional. Deployment ID. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -9651,24 +10108,119 @@ def update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_by_device_group_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Deployment], 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]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DevicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s + :attr:`devices` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def update( + def get( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any ) -> _models.Device: # pylint: disable=line-too-long - """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move - a device to the catalog level. + """Get a Device. Use '.unassigned' or '.default' for the device group and product names when a + device does not belong to a device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9681,9 +10233,6 @@ def update( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param properties: The resource properties to be updated. Is one of the following types: - DeviceUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] :return: Device. The Device is compatible with MutableMapping :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: @@ -9691,21 +10240,11 @@ def update( Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "deviceGroupId": "str" # Optional. Device group id. - } - } - - # response body for status code(s): 200, 202 + # response body for status code(s): 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { "chipSku": "str", # Optional. SKU of the chip. "deviceId": "str", # Optional. Device ID. @@ -9736,7 +10275,9 @@ def update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -9747,20 +10288,80 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + + _request = build_devices_get_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + resource: Union[_models.Device, JSON, IO[bytes]], + **kwargs: Any + ) -> JSON: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Device] = kwargs.pop("cls", None) + cls: ClsType[JSON] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_devices_update_request( + _request = build_devices_create_or_update_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, @@ -9775,14 +10376,14 @@ def update( ) _request.url = self._client.format_url(_request.url) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = 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]: + if response.status_code not in [200, 201]: if _stream: response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) @@ -9791,18 +10392,12 @@ def update( response_headers = {} if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(JSON, response.json()) - if response.status_code == 202: + if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Device, response.json()) + deserialized = _deserialize(JSON, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -9810,21 +10405,21 @@ def update( return deserialized # type: ignore @overload - def generate_capability_image( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: _models.GenerateCapabilityImageRequest, + resource: _models.Device, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> LROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9837,49 +10432,116 @@ def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.spheredpg.models.Device :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of LROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "capabilities": [ - "str" # List of capabilities to create. Required. - ] + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def generate_capability_image( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: JSON, + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> LROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9892,42 +10554,76 @@ def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: JSON + :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: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of LROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def generate_capability_image( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: IO[bytes], + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> LROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9940,40 +10636,74 @@ def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Required. - :type parameters: IO[bytes] + :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: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :return: An instance of LROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 200, 201 response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @distributed_trace - def generate_capability_image( + def begin_create_or_update( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, device_name: str, - parameters: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], + resource: Union[_models.Device, JSON, IO[bytes]], **kwargs: Any - ) -> _models.SignedCapabilityImageResponse: - """Generates the capability image for the device. Use '.unassigned' or '.default' for the device - group and product names to generate the image for a device that does not belong to a specific - device group and product. + ) -> LROPoller[_models.Device]: + # pylint: disable=line-too-long + """Create a Device. Use '.unassigned' or '.default' for the device group and product names to + claim a device to the catalog only. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9986,148 +10716,73 @@ def generate_capability_image( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :param parameters: Generate capability image request body. Is one of the following types: - GenerateCapabilityImageRequest, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or - IO[bytes] - :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + :param resource: Resource create parameters. Is one of the following types: Device, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.spheredpg.models.Device or JSON or IO[bytes] + :return: An instance of LROPoller that returns Device. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Device] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - parameters = { - "capabilities": [ - "str" # List of capabilities to create. Required. - ] - } - - # response body for status code(s): 200, 202 - response == { - "image": "str" # Optional. The signed device capability image as a UTF-8 - encoded base 64 string. + resource = { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SignedCapabilityImageResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_devices_generate_capability_image_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - device_group_name=device_group_name, - device_name=device_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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, 202]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) - - if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - -class ProductsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.spheredpg.AzureSphereClient`'s - :attr:`products` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_catalog( - self, resource_group_name: str, catalog_name: str, **kwargs: Any - ) -> Iterable["_models.Product"]: - # pylint: disable=line-too-long - """List Product resources by Catalog. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :return: An iterator like instance of Product - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 201 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10147,84 +10802,75 @@ def list_by_catalog( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_products_list_by_catalog_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Product], 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) + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Device] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Device, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Device].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Device]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace - def get(self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any) -> _models.Product: + @overload + def update( + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + properties: _models.DeviceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Device: # pylint: disable=line-too-long - """Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10233,23 +10879,45 @@ def get(self, resource_group_name: str, catalog_name: str, product_name: str, ** :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :return: Product. The Product is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Product + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "deviceGroupId": "str" # Optional. Device group id. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10269,141 +10937,28 @@ def get(self, resource_group_name: str, catalog_name: str, product_name: str, ** "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Product] = kwargs.pop("cls", None) - - _request = build_products_get_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Product, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - catalog_name: str, - product_name: str, - resource: Union[_models.Product, JSON, IO[bytes]], - **kwargs: Any - ) -> JSON: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = 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_products_create_or_update_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = _deserialize(JSON, response.json()) - - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(JSON, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore @overload - def begin_create_or_update( + def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: _models.Product, + device_group_name: str, + device_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10412,61 +10967,38 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.spheredpg.models.Product + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_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 Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :paramtype content_type: str + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10486,24 +11018,28 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ @overload - def begin_create_or_update( + def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: JSON, + device_group_name: str, + device_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10512,29 +11048,38 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Required. - :type resource: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_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 Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10554,24 +11099,26 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ - @overload - def begin_create_or_update( + @distributed_trace + def update( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: IO[bytes], - *, - content_type: str = "application/json", + device_group_name: str, + device_name: str, + properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Product]: + ) -> _models.Device: # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move + a device to the catalog level. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10580,29 +11127,43 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_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 Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param properties: The resource properties to be updated. Is one of the following types: + DeviceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 201 + # JSON input template you can fill out and use as your body input. + properties = { + "properties": { + "deviceGroupId": "str" # Optional. Device group id. + } + } + + # response body for status code(s): 200, 202 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. + "name": "str", # Optional. The name of the resource. "properties": { - "description": "str", # Description of the product. Required. + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. "provisioningState": "str" # Optional. The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", and "Accepted". @@ -10622,22 +11183,149 @@ def begin_create_or_update( "lastModifiedByType": "str" # Optional. The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - } + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". } """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Device] = 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_devices_update_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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, 202]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + catalog_name: str, + product_name: str, + device_group_name: str, + device_name: str, + **kwargs: Any + ) -> None: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_devices_delete_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _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")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def begin_create_or_update( + def begin_delete( self, resource_group_name: str, catalog_name: str, product_name: str, - resource: Union[_models.Product, JSON, IO[bytes]], + device_group_name: str, + device_name: str, **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[None]: + """Delete a Device. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10646,96 +11334,28 @@ def begin_create_or_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param resource: Resource create parameters. Is one of the following types: Product, JSON, - IO[bytes] Required. - :type resource: ~azure.mgmt.spheredpg.models.Product or JSON or IO[bytes] - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - resource = { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - - # response body for status code(s): 200, 201 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } """ - _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.Product] = kwargs.pop("cls", None) + 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._create_or_update_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - resource=resource, - content_type=content_type, + device_group_name=device_group_name, + device_name=device_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10743,12 +11363,9 @@ def begin_create_or_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Product, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -10757,19 +11374,83 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Product].from_continuation_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[_models.Product]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_device_group( + self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any + ) -> Iterable["_models.Device"]: + # pylint: disable=line-too-long + """List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values + and cannot be used for product or device group name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param catalog_name: Name of catalog. Required. + :type catalog_name: str + :param product_name: Name of product. Required. + :type product_name: str + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :return: An iterator like instance of Device + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.Device] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # Optional. Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + "name": "str", # Optional. The name of the resource. + "properties": { + "chipSku": "str", # Optional. SKU of the chip. + "deviceId": "str", # Optional. Device ID. + "lastAvailableOsVersion": "str", # Optional. OS version available + for installation when update requested. + "lastInstalledOsVersion": "str", # Optional. OS version running on + device when update requested. + "lastOsUpdateUtc": "2020-02-20 00:00:00", # Optional. Time when + update requested and new OS version available. + "lastUpdateRequestUtc": "2020-02-20 00:00:00", # Optional. Time when + update was last requested. + "provisioningState": "str" # Optional. The status of the last + operation. Known values are: "Succeeded", "Failed", "Canceled", + "Provisioning", "Updating", "Deleting", and "Accepted". + }, + "systemData": { + "createdAt": "2020-02-20", # Optional. The type of identity that + created the resource. + "createdBy": "str", # Optional. The identity that created the + resource. + "createdByType": "str", # Optional. The type of identity that + created the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + "lastModifiedAt": "2020-02-20", # Optional. The timestamp of + resource last modification (UTC). + "lastModifiedBy": "str", # Optional. The identity that last modified + the resource. + "lastModifiedByType": "str" # Optional. The type of identity that + last modified the resource. Known values are: "User", "Application", + "ManagedIdentity", and "Key". + }, + "type": "str" # Optional. The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + } + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> None: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10778,106 +11459,73 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } 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_products_delete_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + def prepare_request(next_link=None): + if not next_link: - if response.status_code not in [200, 202, 204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + _request = build_devices_list_by_device_group_request( + resource_group_name=resource_group_name, + catalog_name=catalog_name, + product_name=product_name, + device_group_name=device_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - 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")) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return _request - @distributed_trace - def begin_delete( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name'. + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Device], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_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 {} + def get_next(next_link=None): + _request = prepare_request(next_link) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return pipeline_response - def _update_initial( + return ItemPaged(get_next, extract_data) + + def _generate_capability_image_initial( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + device_group_name: str, + device_name: str, + body: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -10896,15 +11544,17 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_products_update_request( + _request = build_devices_generate_capability_image_request( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, + device_group_name=device_group_name, + device_name=device_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -10943,19 +11593,21 @@ def _update_initial( return deserialized # type: ignore @overload - def begin_update( + def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: _models.ProductUpdate, + device_group_name: str, + device_name: str, + body: _models.GenerateCapabilityImageRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10964,73 +11616,54 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest :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 Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of LROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "description": "str" # Optional. Description of the product. - } + body = { + "capabilities": [ + "str" # List of capabilities to create. Required. + ] } - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @overload - def begin_update( + def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: JSON, + device_group_name: str, + device_name: str, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11039,66 +11672,47 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: JSON + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of LROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @overload - def begin_update( + def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: IO[bytes], + device_group_name: str, + device_name: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11107,64 +11721,45 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :return: An instance of LROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ @distributed_trace - def begin_update( + def begin_generate_capability_image( self, resource_group_name: str, catalog_name: str, product_name: str, - properties: Union[_models.ProductUpdate, JSON, IO[bytes]], + device_group_name: str, + device_name: str, + body: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Product]: - # pylint: disable=line-too-long - """Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - product name. + ) -> LROPoller[_models.SignedCapabilityImageResponse]: + """Generates the capability image for the device. Use '.unassigned' or '.default' for the device + group and product names to generate the image for a device that does not belong to a specific + device group and product. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11173,70 +11768,51 @@ def begin_update( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :param properties: The resource properties to be updated. Is one of the following types: - ProductUpdate, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.spheredpg.models.ProductUpdate or JSON or IO[bytes] - :return: An instance of LROPoller that returns Product. The Product is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.Product] + :param device_group_name: Name of device group. Required. + :type device_group_name: str + :param device_name: Device name. Required. + :type device_name: str + :param body: Generate capability image request body. Is one of the following types: + GenerateCapabilityImageRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns SignedCapabilityImageResponse. The + SignedCapabilityImageResponse is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python # JSON input template you can fill out and use as your body input. - properties = { - "properties": { - "description": "str" # Optional. Description of the product. - } + body = { + "capabilities": [ + "str" # List of capabilities to create. Required. + ] } - # response body for status code(s): 200, 202 + # response body for status code(s): 202, 200 response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "description": "str", # Description of the product. Required. - "provisioningState": "str" # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } + "image": "str" # Optional. The signed device capability image as a UTF-8 + encoded base 64 string. } """ _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.Product] = kwargs.pop("cls", None) + cls: ClsType[_models.SignedCapabilityImageResponse] = 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( + raw_result = self._generate_capability_image_initial( resource_group_name=resource_group_name, catalog_name=catalog_name, product_name=product_name, - properties=properties, + device_group_name=device_group_name, + device_name=device_name, + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -11246,10 +11822,14 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} response = pipeline_response.http_response - deserialized = _deserialize(_models.Product, response.json()) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -11259,222 +11839,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Product].from_continuation_token( + return LROPoller[_models.SignedCapabilityImageResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Product]( + return LROPoller[_models.SignedCapabilityImageResponse]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - @distributed_trace - def generate_default_device_groups( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> Iterable["_models.DeviceGroup"]: - # pylint: disable=line-too-long - """Generates default device groups for the product. '.default' and '.unassigned' are system - defined values and cannot be used for product name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: An iterator like instance of DeviceGroup - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.spheredpg.models.DeviceGroup] - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "id": "str", # Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - Required. - "type": "str", # The type of the resource. E.g. - "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - Required. - "properties": { - "allowCrashDumpsCollection": "str", # Optional. Flag to define if - the user allows for crash dump collection. Known values are: "Enabled" and - "Disabled". - "description": "str", # Optional. Description of the device group. - "hasDeployment": bool, # Optional. Deployment status for the device - group. - "osFeedType": "str", # Optional. Operating system feed type of the - device group. Known values are: "Retail" and "RetailEval". - "provisioningState": "str", # Optional. The status of the last - operation. Known values are: "Succeeded", "Failed", "Canceled", - "Provisioning", "Updating", "Deleting", and "Accepted". - "regionalDataBoundary": "str", # Optional. Regional data boundary - for the device group. Known values are: "None" and "EU". - "updatePolicy": "str" # Optional. Update policy of the device group. - Known values are: "UpdateAll" and "No3rdPartyAppUpdates". - }, - "systemData": { - "createdAt": "2020-02-20", # Optional. The type of identity that - created the resource. - "createdBy": "str", # Optional. The identity that created the - resource. - "createdByType": "str", # Optional. The type of identity that - created the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - "lastModifiedAt": "2020-02-20", # Optional. The timestamp of - resource last modification (UTC). - "lastModifiedBy": "str", # Optional. The identity that last modified - the resource. - "lastModifiedByType": "str" # Optional. The type of identity that - last modified the resource. Known values are: "User", "Application", - "ManagedIdentity", and "Key". - } - } - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_products_generate_default_device_groups_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.DeviceGroup], 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]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _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 - def count_devices( - self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> _models.CountDeviceResponse: - """Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be - used for product name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param catalog_name: Name of catalog. Required. - :type catalog_name: str - :param product_name: Name of product. Required. - :type product_name: str - :return: CountDeviceResponse. The CountDeviceResponse is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.CountDeviceResponse - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "value": 0 # Number of children resources in parent resource. Required. - } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.CountDeviceResponse] = kwargs.pop("cls", None) - - _request = build_products_count_devices_request( - resource_group_name=resource_group_name, - catalog_name=catalog_name, - product_name=product_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _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: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.CountDeviceResponse, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/apiview_mapping_python.json deleted file mode 100644 index 4a6e53675fa..00000000000 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/apiview_mapping_python.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.Core.Lro.Rpc", - "CrossLanguageDefinitionId": { - "azurecore.lro.rpc.models.Error": "Azure.Core.Foundations.Error", - "azurecore.lro.rpc.models.GenerationOptions": "_Specs_.Azure.Core.Lro.Rpc.GenerationOptions", - "azurecore.lro.rpc.models.GenerationResponse": "_Specs_.Azure.Core.Lro.Rpc.GenerationResponse", - "azurecore.lro.rpc.models.GenerationResult": "_Specs_.Azure.Core.Lro.Rpc.GenerationResult", - "azurecore.lro.rpc.models.InnerError": "Azure.Core.Foundations.InnerError", - "azurecore.lro.rpc.models.OperationState": "Azure.Core.Foundations.OperationState", - "azurecore.lro.rpc.RpcClient.begin_long_running_rpc": "longRunningRpc" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/apiview_mapping_python.json deleted file mode 100644 index e915b4c3afa..00000000000 --- a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/apiview_mapping_python.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "CrossLanguagePackageId": "Client.Structure.Service", - "CrossLanguageDefinitionId": { - "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType", - "client.structure.service.ServiceClient.qux.eight": "eight", - "client.structure.service.ServiceClient.foo.three": "three", - "client.structure.service.ServiceClient.foo.four": "four", - "client.structure.service.ServiceClient.bar.five": "five", - "client.structure.service.ServiceClient.bar.six": "six", - "client.structure.service.ServiceClient.one": "one", - "client.structure.service.ServiceClient.two": "two" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/apiview_mapping_python.json deleted file mode 100644 index ea78977021b..00000000000 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/apiview_mapping_python.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "Client.Structure.Service", - "CrossLanguageDefinitionId": { - "client.structure.multiclient.models.ClientType": "Client.Structure.Service.ClientType", - "client.structure.multiclient.ClientAClient.renamed_one": "renamedOne", - "client.structure.multiclient.ClientAClient.renamed_three": "renamedThree", - "client.structure.multiclient.ClientAClient.renamed_five": "renamedFive", - "client.structure.multiclient.ClientBClient.renamed_two": "renamedTwo", - "client.structure.multiclient.ClientBClient.renamed_four": "renamedFour", - "client.structure.multiclient.ClientBClient.renamed_six": "renamedSix" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/apiview_mapping_python.json deleted file mode 100644 index 17e44c8793e..00000000000 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/apiview_mapping_python.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "CrossLanguagePackageId": "Encode.Bytes", - "CrossLanguageDefinitionId": { - "encode.bytes.models.Base64BytesProperty": "Encode.Bytes.Base64BytesProperty", - "encode.bytes.models.Base64urlArrayBytesProperty": "Encode.Bytes.Base64urlArrayBytesProperty", - "encode.bytes.models.Base64urlBytesProperty": "Encode.Bytes.Base64urlBytesProperty", - "encode.bytes.models.DefaultBytesProperty": "Encode.Bytes.DefaultBytesProperty", - "encode.bytes.BytesClient.query.default": "default", - "encode.bytes.BytesClient.query.base64": "base64", - "encode.bytes.BytesClient.query.base64url": "base64url", - "encode.bytes.BytesClient.query.base64url_array": "base64urlArray", - "encode.bytes.BytesClient.property.default": "default", - "encode.bytes.BytesClient.property.base64": "base64", - "encode.bytes.BytesClient.property.base64url": "base64url", - "encode.bytes.BytesClient.property.base64url_array": "base64urlArray", - "encode.bytes.BytesClient.header.default": "default", - "encode.bytes.BytesClient.header.base64": "base64", - "encode.bytes.BytesClient.header.base64url": "base64url", - "encode.bytes.BytesClient.header.base64url_array": "base64urlArray", - "encode.bytes.BytesClient.request_body.default": "default", - "encode.bytes.BytesClient.request_body.octet_stream": "octetStream", - "encode.bytes.BytesClient.request_body.custom_content_type": "customContentType", - "encode.bytes.BytesClient.request_body.base64": "base64", - "encode.bytes.BytesClient.request_body.base64url": "base64url", - "encode.bytes.BytesClient.response_body.default": "default", - "encode.bytes.BytesClient.response_body.octet_stream": "octetStream", - "encode.bytes.BytesClient.response_body.custom_content_type": "customContentType", - "encode.bytes.BytesClient.response_body.base64": "base64", - "encode.bytes.BytesClient.response_body.base64url": "base64url" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py index 4adc44ee4c6..e3c26520e02 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py @@ -26,6 +26,7 @@ from .. import models as _models from .._model_base import _deserialize from .._serialization import Serializer +from .._validation import api_version_validation from .._vendor import PageableClientMixinABC if sys.version_info >= (3, 9): @@ -61,6 +62,9 @@ def build_pageable_list_request(*, maxpagesize: Optional[int] = None, **kwargs: class PageableClientOperationsMixin(PageableClientMixinABC): @distributed_trace + @api_version_validation( + params_added_on={"1.0-preview.1": ["maxpagesize"]}, + ) def list(self, **kwargs: Any) -> Iterable["_models.User"]: """List users. diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_validation.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_validation.py new file mode 100644 index 00000000000..752b2822f9d --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_validation.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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 functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if method_added_on > client_api_version: + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and api_version > client_api_version + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py index ee55adb3573..f42debf579e 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py @@ -25,6 +25,7 @@ from ... import models as _models from ..._model_base import _deserialize from ..._operations._operations import build_pageable_list_request +from ..._validation import api_version_validation from .._vendor import PageableClientMixinABC if sys.version_info >= (3, 9): @@ -38,6 +39,9 @@ class PageableClientOperationsMixin(PageableClientMixinABC): @distributed_trace + @api_version_validation( + params_added_on={"1.0-preview.1": ["maxpagesize"]}, + ) def list(self, **kwargs: Any) -> AsyncIterable["_models.User"]: """List users. diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/apiview_mapping_python.json deleted file mode 100644 index 723e29dd073..00000000000 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/apiview_mapping_python.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "CrossLanguagePackageId": "Payload.Pageable", - "CrossLanguageDefinitionId": { - "payload.pageable.models.User": "Payload.Pageable.User", - "payload.pageable.PageableClient.list": "list" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/apiview_mapping_python.json deleted file mode 100644 index 8ca87cc12c9..00000000000 --- a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/apiview_mapping_python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "CrossLanguagePackageId": "Server.Versions.Versioned", - "CrossLanguageDefinitionId": { - "server.versions.versioned.VersionedClient.without_api_version": "withoutApiVersion", - "server.versions.versioned.VersionedClient.with_query_api_version": "withQueryApiVersion", - "server.versions.versioned.VersionedClient.with_path_api_version": "withPathApiVersion" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/special-words/specialwords/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/special-words/specialwords/apiview_mapping_python.json deleted file mode 100644 index e669e182f4b..00000000000 --- a/packages/typespec-python/test/azure/generated/special-words/specialwords/apiview_mapping_python.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "CrossLanguagePackageId": "SpecialWords", - "CrossLanguageDefinitionId": { - "specialwords.models.AndModel": "SpecialWords.Models.and", - "specialwords.models.AsModel": "SpecialWords.Models.as", - "specialwords.models.AssertModel": "SpecialWords.Models.assert", - "specialwords.models.AsyncModel": "SpecialWords.Models.async", - "specialwords.models.AwaitModel": "SpecialWords.Models.await", - "specialwords.models.BreakModel": "SpecialWords.Models.break", - "specialwords.models.ClassModel": "SpecialWords.Models.class", - "specialwords.models.Constructor": "SpecialWords.Models.constructor", - "specialwords.models.ContinueModel": "SpecialWords.Models.continue", - "specialwords.models.DefModel": "SpecialWords.Models.def", - "specialwords.models.DelModel": "SpecialWords.Models.del", - "specialwords.models.ElifModel": "SpecialWords.Models.elif", - "specialwords.models.ElseModel": "SpecialWords.Models.else", - "specialwords.models.ExceptModel": "SpecialWords.Models.except", - "specialwords.models.ExecModel": "SpecialWords.Models.exec", - "specialwords.models.FinallyModel": "SpecialWords.Models.finally", - "specialwords.models.ForModel": "SpecialWords.Models.for", - "specialwords.models.FromModel": "SpecialWords.Models.from", - "specialwords.models.GlobalModel": "SpecialWords.Models.global", - "specialwords.models.IfModel": "SpecialWords.Models.if", - "specialwords.models.ImportModel": "SpecialWords.Models.import", - "specialwords.models.InModel": "SpecialWords.Models.in", - "specialwords.models.IsModel": "SpecialWords.Models.is", - "specialwords.models.LambdaModel": "SpecialWords.Models.lambda", - "specialwords.models.NotModel": "SpecialWords.Models.not", - "specialwords.models.OrModel": "SpecialWords.Models.or", - "specialwords.models.PassModel": "SpecialWords.Models.pass", - "specialwords.models.RaiseModel": "SpecialWords.Models.raise", - "specialwords.models.ReturnModel": "SpecialWords.Models.return", - "specialwords.models.SameAsModel": "SpecialWords.ModelProperties.SameAsModel", - "specialwords.models.TryModel": "SpecialWords.Models.try", - "specialwords.models.WhileModel": "SpecialWords.Models.while", - "specialwords.models.WithModel": "SpecialWords.Models.with", - "specialwords.models.YieldModel": "SpecialWords.Models.yield", - "specialwords.SpecialWordsClient.models.with_and": "withAnd", - "specialwords.SpecialWordsClient.models.with_as": "withAs", - "specialwords.SpecialWordsClient.models.with_assert": "withAssert", - "specialwords.SpecialWordsClient.models.with_async": "withAsync", - "specialwords.SpecialWordsClient.models.with_await": "withAwait", - "specialwords.SpecialWordsClient.models.with_break": "withBreak", - "specialwords.SpecialWordsClient.models.with_class": "withClass", - "specialwords.SpecialWordsClient.models.with_constructor": "withConstructor", - "specialwords.SpecialWordsClient.models.with_continue": "withContinue", - "specialwords.SpecialWordsClient.models.with_def": "withDef", - "specialwords.SpecialWordsClient.models.with_del": "withDel", - "specialwords.SpecialWordsClient.models.with_elif": "withElif", - "specialwords.SpecialWordsClient.models.with_else": "withElse", - "specialwords.SpecialWordsClient.models.with_except": "withExcept", - "specialwords.SpecialWordsClient.models.with_exec": "withExec", - "specialwords.SpecialWordsClient.models.with_finally": "withFinally", - "specialwords.SpecialWordsClient.models.with_for": "withFor", - "specialwords.SpecialWordsClient.models.with_from": "withFrom", - "specialwords.SpecialWordsClient.models.with_global": "withGlobal", - "specialwords.SpecialWordsClient.models.with_if": "withIf", - "specialwords.SpecialWordsClient.models.with_import": "withImport", - "specialwords.SpecialWordsClient.models.with_in": "withIn", - "specialwords.SpecialWordsClient.models.with_is": "withIs", - "specialwords.SpecialWordsClient.models.with_lambda": "withLambda", - "specialwords.SpecialWordsClient.models.with_not": "withNot", - "specialwords.SpecialWordsClient.models.with_or": "withOr", - "specialwords.SpecialWordsClient.models.with_pass": "withPass", - "specialwords.SpecialWordsClient.models.with_raise": "withRaise", - "specialwords.SpecialWordsClient.models.with_return": "withReturn", - "specialwords.SpecialWordsClient.models.with_try": "withTry", - "specialwords.SpecialWordsClient.models.with_while": "withWhile", - "specialwords.SpecialWordsClient.models.with_with": "withWith", - "specialwords.SpecialWordsClient.models.with_yield": "withYield", - "specialwords.SpecialWordsClient.model_properties.same_as_model": "sameAsModel", - "specialwords.SpecialWordsClient.operations.and_method": "and", - "specialwords.SpecialWordsClient.operations.as_method": "as", - "specialwords.SpecialWordsClient.operations.assert_method": "assert", - "specialwords.SpecialWordsClient.operations.async_method": "async", - "specialwords.SpecialWordsClient.operations.await_method": "await", - "specialwords.SpecialWordsClient.operations.break_method": "break", - "specialwords.SpecialWordsClient.operations.class_method": "class", - "specialwords.SpecialWordsClient.operations.constructor": "constructor", - "specialwords.SpecialWordsClient.operations.continue_method": "continue", - "specialwords.SpecialWordsClient.operations.def_method": "def", - "specialwords.SpecialWordsClient.operations.del_method": "del", - "specialwords.SpecialWordsClient.operations.elif_method": "elif", - "specialwords.SpecialWordsClient.operations.else_method": "else", - "specialwords.SpecialWordsClient.operations.except_method": "except", - "specialwords.SpecialWordsClient.operations.exec_method": "exec", - "specialwords.SpecialWordsClient.operations.finally_method": "finally", - "specialwords.SpecialWordsClient.operations.for_method": "for", - "specialwords.SpecialWordsClient.operations.from_method": "from", - "specialwords.SpecialWordsClient.operations.global_method": "global", - "specialwords.SpecialWordsClient.operations.if_method": "if", - "specialwords.SpecialWordsClient.operations.import_method": "import", - "specialwords.SpecialWordsClient.operations.in_method": "in", - "specialwords.SpecialWordsClient.operations.is_method": "is", - "specialwords.SpecialWordsClient.operations.lambda_method": "lambda", - "specialwords.SpecialWordsClient.operations.not_method": "not", - "specialwords.SpecialWordsClient.operations.or_method": "or", - "specialwords.SpecialWordsClient.operations.pass_method": "pass", - "specialwords.SpecialWordsClient.operations.raise_method": "raise", - "specialwords.SpecialWordsClient.operations.return_method": "return", - "specialwords.SpecialWordsClient.operations.try_method": "try", - "specialwords.SpecialWordsClient.operations.while_method": "while", - "specialwords.SpecialWordsClient.operations.with_method": "with", - "specialwords.SpecialWordsClient.operations.yield_method": "yield", - "specialwords.SpecialWordsClient.parameters.with_and": "withAnd", - "specialwords.SpecialWordsClient.parameters.with_as": "withAs", - "specialwords.SpecialWordsClient.parameters.with_assert": "withAssert", - "specialwords.SpecialWordsClient.parameters.with_async": "withAsync", - "specialwords.SpecialWordsClient.parameters.with_await": "withAwait", - "specialwords.SpecialWordsClient.parameters.with_break": "withBreak", - "specialwords.SpecialWordsClient.parameters.with_class": "withClass", - "specialwords.SpecialWordsClient.parameters.with_constructor": "withConstructor", - "specialwords.SpecialWordsClient.parameters.with_continue": "withContinue", - "specialwords.SpecialWordsClient.parameters.with_def": "withDef", - "specialwords.SpecialWordsClient.parameters.with_del": "withDel", - "specialwords.SpecialWordsClient.parameters.with_elif": "withElif", - "specialwords.SpecialWordsClient.parameters.with_else": "withElse", - "specialwords.SpecialWordsClient.parameters.with_except": "withExcept", - "specialwords.SpecialWordsClient.parameters.with_exec": "withExec", - "specialwords.SpecialWordsClient.parameters.with_finally": "withFinally", - "specialwords.SpecialWordsClient.parameters.with_for": "withFor", - "specialwords.SpecialWordsClient.parameters.with_from": "withFrom", - "specialwords.SpecialWordsClient.parameters.with_global": "withGlobal", - "specialwords.SpecialWordsClient.parameters.with_if": "withIf", - "specialwords.SpecialWordsClient.parameters.with_import": "withImport", - "specialwords.SpecialWordsClient.parameters.with_in": "withIn", - "specialwords.SpecialWordsClient.parameters.with_is": "withIs", - "specialwords.SpecialWordsClient.parameters.with_lambda": "withLambda", - "specialwords.SpecialWordsClient.parameters.with_not": "withNot", - "specialwords.SpecialWordsClient.parameters.with_or": "withOr", - "specialwords.SpecialWordsClient.parameters.with_pass": "withPass", - "specialwords.SpecialWordsClient.parameters.with_raise": "withRaise", - "specialwords.SpecialWordsClient.parameters.with_return": "withReturn", - "specialwords.SpecialWordsClient.parameters.with_try": "withTry", - "specialwords.SpecialWordsClient.parameters.with_while": "withWhile", - "specialwords.SpecialWordsClient.parameters.with_with": "withWith", - "specialwords.SpecialWordsClient.parameters.with_yield": "withYield", - "specialwords.SpecialWordsClient.parameters.with_cancellation_token": "withCancellationToken" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/apiview_mapping_python.json deleted file mode 100644 index 54eedb38ae7..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/apiview_mapping_python.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Enum.Fixed", - "CrossLanguageDefinitionId": { - "typetest.enum.fixed.models.DaysOfWeekEnum": "Type.Enum.Fixed.DaysOfWeekEnum", - "typetest.enum.fixed.FixedClient.string.get_known_value": "getKnownValue", - "typetest.enum.fixed.FixedClient.string.put_known_value": "putKnownValue", - "typetest.enum.fixed.FixedClient.string.put_unknown_value": "putUnknownValue" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/apiview_mapping_python.json deleted file mode 100644 index 8e1fd91daf2..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/apiview_mapping_python.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Inheritance.EnumDiscriminator", - "CrossLanguageDefinitionId": { - "typetest.model.enumdiscriminator.models.Snake": "Type.Model.Inheritance.EnumDiscriminator.Snake", - "typetest.model.enumdiscriminator.models.Cobra": "Type.Model.Inheritance.EnumDiscriminator.Cobra", - "typetest.model.enumdiscriminator.models.Dog": "Type.Model.Inheritance.EnumDiscriminator.Dog", - "typetest.model.enumdiscriminator.models.Golden": "Type.Model.Inheritance.EnumDiscriminator.Golden", - "typetest.model.enumdiscriminator.models.DogKind": "Type.Model.Inheritance.EnumDiscriminator.DogKind", - "typetest.model.enumdiscriminator.models.SnakeKind": "Type.Model.Inheritance.EnumDiscriminator.SnakeKind", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_extensible_model": "getExtensibleModel", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.put_extensible_model": "putExtensibleModel", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_extensible_model_missing_discriminator": "getExtensibleModelMissingDiscriminator", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_extensible_model_wrong_discriminator": "getExtensibleModelWrongDiscriminator", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_fixed_model": "getFixedModel", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.put_fixed_model": "putFixedModel", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_fixed_model_missing_discriminator": "getFixedModelMissingDiscriminator", - "typetest.model.enumdiscriminator.EnumDiscriminatorClient.get_fixed_model_wrong_discriminator": "getFixedModelWrongDiscriminator" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/apiview_mapping_python.json deleted file mode 100644 index 4b90702a251..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/apiview_mapping_python.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Property.AdditionalProperties", - "CrossLanguageDefinitionId": { - "typetest.property.additionalproperties.models.ExtendsFloatAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsFloatAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsModelAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsModelAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsModelArrayAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsStringAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsStringAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsUnknownAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalProperties", - "typetest.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDerived", - "typetest.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminated", - "typetest.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived", - "typetest.property.additionalproperties.models.IsFloatAdditionalProperties": "Type.Property.AdditionalProperties.IsFloatAdditionalProperties", - "typetest.property.additionalproperties.models.IsModelAdditionalProperties": "Type.Property.AdditionalProperties.IsModelAdditionalProperties", - "typetest.property.additionalproperties.models.IsModelArrayAdditionalProperties": "Type.Property.AdditionalProperties.IsModelArrayAdditionalProperties", - "typetest.property.additionalproperties.models.IsStringAdditionalProperties": "Type.Property.AdditionalProperties.IsStringAdditionalProperties", - "typetest.property.additionalproperties.models.IsUnknownAdditionalProperties": "Type.Property.AdditionalProperties.IsUnknownAdditionalProperties", - "typetest.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDerived", - "typetest.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminated", - "typetest.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminatedDerived": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminatedDerived", - "typetest.property.additionalproperties.models.ModelForRecord": "Type.Property.AdditionalProperties.ModelForRecord", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown_derived.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown_derived.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown_discriminated.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_unknown_discriminated.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown_derived.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown_derived.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown_discriminated.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_unknown_discriminated.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_string.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_string.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_string.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_string.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_float.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_float.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_float.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_float.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_model.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_model.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_model.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_model.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_model_array.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.extends_model_array.put": "put", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_model_array.get": "get", - "typetest.property.additionalproperties.AdditionalPropertiesClient.is_model_array.put": "put" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/apiview_mapping_python.json deleted file mode 100644 index 9ceea55ea0d..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/apiview_mapping_python.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Property.ValueTypes", - "CrossLanguageDefinitionId": { - "typetest.property.valuetypes.models.BooleanLiteralProperty": "Type.Property.ValueTypes.BooleanLiteralProperty", - "typetest.property.valuetypes.models.BooleanProperty": "Type.Property.ValueTypes.BooleanProperty", - "typetest.property.valuetypes.models.BytesProperty": "Type.Property.ValueTypes.BytesProperty", - "typetest.property.valuetypes.models.CollectionsIntProperty": "Type.Property.ValueTypes.CollectionsIntProperty", - "typetest.property.valuetypes.models.CollectionsModelProperty": "Type.Property.ValueTypes.CollectionsModelProperty", - "typetest.property.valuetypes.models.CollectionsStringProperty": "Type.Property.ValueTypes.CollectionsStringProperty", - "typetest.property.valuetypes.models.DatetimeProperty": "Type.Property.ValueTypes.DatetimeProperty", - "typetest.property.valuetypes.models.Decimal128Property": "Type.Property.ValueTypes.Decimal128Property", - "typetest.property.valuetypes.models.DecimalProperty": "Type.Property.ValueTypes.DecimalProperty", - "typetest.property.valuetypes.models.DictionaryStringProperty": "Type.Property.ValueTypes.DictionaryStringProperty", - "typetest.property.valuetypes.models.DurationProperty": "Type.Property.ValueTypes.DurationProperty", - "typetest.property.valuetypes.models.EnumProperty": "Type.Property.ValueTypes.EnumProperty", - "typetest.property.valuetypes.models.ExtensibleEnumProperty": "Type.Property.ValueTypes.ExtensibleEnumProperty", - "typetest.property.valuetypes.models.FloatLiteralProperty": "Type.Property.ValueTypes.FloatLiteralProperty", - "typetest.property.valuetypes.models.FloatProperty": "Type.Property.ValueTypes.FloatProperty", - "typetest.property.valuetypes.models.InnerModel": "Type.Property.ValueTypes.InnerModel", - "typetest.property.valuetypes.models.IntLiteralProperty": "Type.Property.ValueTypes.IntLiteralProperty", - "typetest.property.valuetypes.models.IntProperty": "Type.Property.ValueTypes.IntProperty", - "typetest.property.valuetypes.models.ModelProperty": "Type.Property.ValueTypes.ModelProperty", - "typetest.property.valuetypes.models.NeverProperty": "Type.Property.ValueTypes.NeverProperty", - "typetest.property.valuetypes.models.StringLiteralProperty": "Type.Property.ValueTypes.StringLiteralProperty", - "typetest.property.valuetypes.models.StringProperty": "Type.Property.ValueTypes.StringProperty", - "typetest.property.valuetypes.models.UnionEnumValueProperty": "Type.Property.ValueTypes.UnionEnumValueProperty", - "typetest.property.valuetypes.models.UnionFloatLiteralProperty": "Type.Property.ValueTypes.UnionFloatLiteralProperty", - "typetest.property.valuetypes.models.UnionIntLiteralProperty": "Type.Property.ValueTypes.UnionIntLiteralProperty", - "typetest.property.valuetypes.models.UnionStringLiteralProperty": "Type.Property.ValueTypes.UnionStringLiteralProperty", - "typetest.property.valuetypes.models.UnknownArrayProperty": "Type.Property.ValueTypes.UnknownArrayProperty", - "typetest.property.valuetypes.models.UnknownDictProperty": "Type.Property.ValueTypes.UnknownDictProperty", - "typetest.property.valuetypes.models.UnknownIntProperty": "Type.Property.ValueTypes.UnknownIntProperty", - "typetest.property.valuetypes.models.UnknownStringProperty": "Type.Property.ValueTypes.UnknownStringProperty", - "typetest.property.valuetypes.models.ExtendedEnum": "Type.Property.ValueTypes.ExtendedEnum", - "typetest.property.valuetypes.models.InnerEnum": "Type.Property.ValueTypes.InnerEnum", - "typetest.property.valuetypes.models.FixedInnerEnum": "Type.Property.ValueTypes.FixedInnerEnum", - "typetest.property.valuetypes.ValueTypesClient.boolean.get": "get", - "typetest.property.valuetypes.ValueTypesClient.boolean.put": "put", - "typetest.property.valuetypes.ValueTypesClient.string.get": "get", - "typetest.property.valuetypes.ValueTypesClient.string.put": "put", - "typetest.property.valuetypes.ValueTypesClient.bytes.get": "get", - "typetest.property.valuetypes.ValueTypesClient.bytes.put": "put", - "typetest.property.valuetypes.ValueTypesClient.int_operations.get": "get", - "typetest.property.valuetypes.ValueTypesClient.int_operations.put": "put", - "typetest.property.valuetypes.ValueTypesClient.float.get": "get", - "typetest.property.valuetypes.ValueTypesClient.float.put": "put", - "typetest.property.valuetypes.ValueTypesClient.decimal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.decimal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.decimal128.get": "get", - "typetest.property.valuetypes.ValueTypesClient.decimal128.put": "put", - "typetest.property.valuetypes.ValueTypesClient.datetime.get": "get", - "typetest.property.valuetypes.ValueTypesClient.datetime.put": "put", - "typetest.property.valuetypes.ValueTypesClient.duration.get": "get", - "typetest.property.valuetypes.ValueTypesClient.duration.put": "put", - "typetest.property.valuetypes.ValueTypesClient.enum.get": "get", - "typetest.property.valuetypes.ValueTypesClient.enum.put": "put", - "typetest.property.valuetypes.ValueTypesClient.extensible_enum.get": "get", - "typetest.property.valuetypes.ValueTypesClient.extensible_enum.put": "put", - "typetest.property.valuetypes.ValueTypesClient.model.get": "get", - "typetest.property.valuetypes.ValueTypesClient.model.put": "put", - "typetest.property.valuetypes.ValueTypesClient.collections_string.get": "get", - "typetest.property.valuetypes.ValueTypesClient.collections_string.put": "put", - "typetest.property.valuetypes.ValueTypesClient.collections_int.get": "get", - "typetest.property.valuetypes.ValueTypesClient.collections_int.put": "put", - "typetest.property.valuetypes.ValueTypesClient.collections_model.get": "get", - "typetest.property.valuetypes.ValueTypesClient.collections_model.put": "put", - "typetest.property.valuetypes.ValueTypesClient.dictionary_string.get": "get", - "typetest.property.valuetypes.ValueTypesClient.dictionary_string.put": "put", - "typetest.property.valuetypes.ValueTypesClient.never.get": "get", - "typetest.property.valuetypes.ValueTypesClient.never.put": "put", - "typetest.property.valuetypes.ValueTypesClient.unknown_string.get": "get", - "typetest.property.valuetypes.ValueTypesClient.unknown_string.put": "put", - "typetest.property.valuetypes.ValueTypesClient.unknown_int.get": "get", - "typetest.property.valuetypes.ValueTypesClient.unknown_int.put": "put", - "typetest.property.valuetypes.ValueTypesClient.unknown_dict.get": "get", - "typetest.property.valuetypes.ValueTypesClient.unknown_dict.put": "put", - "typetest.property.valuetypes.ValueTypesClient.unknown_array.get": "get", - "typetest.property.valuetypes.ValueTypesClient.unknown_array.put": "put", - "typetest.property.valuetypes.ValueTypesClient.string_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.string_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.int_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.int_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.float_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.float_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.boolean_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.boolean_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.union_string_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.union_string_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.union_int_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.union_int_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.union_float_literal.get": "get", - "typetest.property.valuetypes.ValueTypesClient.union_float_literal.put": "put", - "typetest.property.valuetypes.ValueTypesClient.union_enum_value.get": "get", - "typetest.property.valuetypes.ValueTypesClient.union_enum_value.put": "put" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py index 22dccae3bcd..ca097a11089 100644 --- a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/aio/operations/_operations.py @@ -62,8 +62,8 @@ def __init__(self, *args, **kwargs) -> None: @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -99,8 +99,8 @@ async def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -129,8 +129,8 @@ async def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -159,8 +159,8 @@ async def v2_in_interface( @distributed_trace_async @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -249,8 +249,7 @@ class AddedClientOperationsMixin(AddedClientMixinABC): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: _models.ModelV1, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -290,8 +289,7 @@ async def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: JSON, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -323,8 +321,7 @@ async def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: IO[bytes], *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -356,8 +353,7 @@ async def v1( @distributed_trace_async @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, **kwargs: Any @@ -450,7 +446,8 @@ async def v1( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -486,7 +483,8 @@ async def v2( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -513,7 +511,8 @@ async def v2(self, body: JSON, *, content_type: str = "application/json", **kwar @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -540,7 +539,8 @@ async def v2(self, body: IO[bytes], *, content_type: str = "application/json", * @distributed_trace_async @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2. diff --git a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py index e53f0ea7bec..572fa86ef03 100644 --- a/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/versioning-added/versioning/added/operations/_operations.py @@ -113,8 +113,8 @@ def __init__(self, *args, **kwargs): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -150,8 +150,8 @@ def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -178,8 +178,8 @@ def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -208,8 +208,8 @@ def v2_in_interface( @distributed_trace @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -298,8 +298,7 @@ class AddedClientOperationsMixin(AddedClientMixinABC): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: _models.ModelV1, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -339,8 +338,7 @@ def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: JSON, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -372,8 +370,7 @@ def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: IO[bytes], *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -405,8 +402,7 @@ def v1( @distributed_trace @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1(self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, **kwargs: Any) -> _models.ModelV1: """v1. @@ -497,7 +493,8 @@ def v1(self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, * @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -531,7 +528,8 @@ def v2(self, body: _models.ModelV2, *, content_type: str = "application/json", * @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -558,7 +556,8 @@ def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: An @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -585,7 +584,8 @@ def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwarg @distributed_trace @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2. diff --git a/packages/typespec-python/test/azure/mock_api_tests/test_mgmt_models_mode.py b/packages/typespec-python/test/azure/mock_api_tests/test_mgmt_models_mode.py index 3fce5d43e92..a81a5c67139 100644 --- a/packages/typespec-python/test/azure/mock_api_tests/test_mgmt_models_mode.py +++ b/packages/typespec-python/test/azure/mock_api_tests/test_mgmt_models_mode.py @@ -22,6 +22,6 @@ def test_client_signature(): def test_model_mode(): from azure.mgmt.spheredpg import _model_base - from azure.mgmt.spheredpg.models import ArmResource as ArmResourceDpg + from azure.mgmt.spheredpg.models import Resource - assert isinstance(ArmResourceDpg(id="", type=""), _model_base.Model) + assert isinstance(Resource(id="", type=""), _model_base.Model) diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp index 6610588b813..28023f7a915 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/catalog.tsp @@ -1,121 +1,158 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; -using Azure.ClientGenerator.Core; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -//Catalogs -@doc("An Azure Sphere catalog") -model Catalog is TrackedResource { - @doc("Name of catalog") +/** + * An Azure Sphere catalog + */ +model Catalog is Azure.ResourceManager.TrackedResource { + /** + * Name of catalog + */ @pattern("^[A-Za-z0-9_-]{1,50}$") - @key("catalogName") @path + @key("catalogName") @segment("catalogs") - name: string; -} - -@doc("Catalog properties") -model CatalogProperties { @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} - -@doc("Request of the action to list device groups for a catalog.") -model ListDeviceGroupsRequest { - @doc("Device Group name.") - deviceGroupName?: string; -} -@doc("Device insight report.") -model DeviceInsight { - @doc("Device ID") - deviceId: string; - - @doc("Event description") - description: string; - - @doc("Event start timestamp") - startTimestampUtc: utcDateTime; - - @doc("Event end timestamp") - endTimestampUtc: utcDateTime; - - @doc("Event category") - eventCategory: string; - - @doc("Event class") - eventClass: string; - - @doc("Event type") - eventType: string; - - @doc("Event count") - eventCount: int32; + name: string; } @armResourceOperations -interface Catalogs - extends Azure.ResourceManager.TrackedResourceOperations< - Catalog, - CatalogProperties - > { - @autoRoute - @doc("Counts devices in catalog.") - @armResourceAction(Catalog) - @post - countDevices( - ...ResourceInstanceParameters, - ): ArmResponse | ErrorResponse; - - @autoRoute - @doc("Lists device insights for catalog.") - @armResourceAction(Catalog) - @post - listDeviceInsights( - ...ResourceInstanceParameters, - ...ListQueryParameters, - ): ArmResponse> | ErrorResponse; - - @autoRoute - @doc("Lists devices for catalog.") - @armResourceAction(Catalog) - @post - listDevices( - ...ResourceInstanceParameters, - ...ListQueryParameters, - ): ArmResponse> | ErrorResponse; - - @autoRoute - @doc("Lists deployments for catalog.") - @armResourceAction(Catalog) - @post - listDeployments( - ...ResourceInstanceParameters, - ...ListQueryParameters, - ): ArmResponse> | ErrorResponse; - - @autoRoute - @armResourceAction(Catalog) - @doc("List the device groups for the catalog.") - @post - listDeviceGroups( - ...ResourceInstanceParameters, - ...ListQueryParameters, - - @doc("List device groups for catalog.") - @body - @projectedName("python", "parameters") - listDeviceGroupsRequest: ListDeviceGroupsRequest, - ): ArmResponse> | ErrorResponse; +interface Catalogs { + /** + * Get a Catalog + */ + get is ArmResourceRead; + + /** + * Create a Catalog + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + /** + * Update a Catalog + */ + @parameterVisibility + update is ArmCustomPatchSync; + + /** + * Delete a Catalog + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; + + /** + * List Catalog resources by resource group + */ + listByResourceGroup is ArmResourceListByParent; + + /** + * List Catalog resources by subscription ID + */ + listBySubscription is ArmListBySubscription; + + /** + * Counts devices in catalog. + */ + countDevices is ArmResourceActionSync; + + /** + * Lists deployments for catalog. + */ + listDeployments is ArmResourceActionSync< + Catalog, + void, + ResourceListResult, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * List the device groups for the catalog. + */ + listDeviceGroups is ArmResourceActionSync< + Catalog, + ListDeviceGroupsRequest, + ResourceListResult, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * Lists device insights for catalog. + */ + listDeviceInsights is ArmResourceActionSync< + Catalog, + void, + PagedDeviceInsight, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * Lists devices for catalog. + */ + listDevices is ArmResourceActionSync< + Catalog, + void, + ResourceListResult, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * Creates an image. Use this action when the image ID is unknown. + */ + uploadImage is ArmResourceActionNoResponseContentAsync; } + +@@doc(Catalogs.listDeviceGroups::parameters.body, + "List device groups for catalog." +); +@@encodedName(Catalogs.listDeviceGroups::parameters.body, + "application/json", + "listDeviceGroupsRequest" +); +@@extension(Catalogs.listDeviceGroups::parameters.body, + "x-ms-client-name", + "listDeviceGroupsRequest" +); +@@doc(Catalogs.uploadImage::parameters.body, "Image upload request body."); +@@encodedName(Catalogs.uploadImage::parameters.body, + "application/json", + "uploadImageRequest" +); +@@extension(Catalogs.uploadImage::parameters.body, + "x-ms-client-name", + "uploadImageRequest" +); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp index d1fccb86b43..3f33f1a9376 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/certificate.tsp @@ -1,98 +1,81 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./catalog.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; -using Azure.ClientGenerator.Core; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -//Certificates -@doc("An certificate resource belonging to a catalog resource.") +/** + * An certificate resource belonging to a catalog resource. + */ @parentResource(Catalog) -model Certificate is ProxyResource { - @doc("Serial number of the certificate. Use '.default' to get current active certificate.") - @key("serialNumber") +model Certificate is Azure.ResourceManager.ProxyResource { + /** + * Serial number of the certificate. Use '.default' to get current active certificate. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern" "existing api" @path + @key("serialNumber") @segment("certificates") + @visibility("read") name: string; } @armResourceOperations -interface Certificates - extends ProxyResourceOperationsReadList { - @autoRoute - @doc("Retrieves cert chain.") - @armResourceAction(Certificate) - @post - retrieveCertChain( - ...ResourceInstanceParameters, - ): ArmResponse | ErrorResponse; - - @autoRoute - @armResourceAction(Certificate) - @post - @doc("Gets the proof of possession nonce.") - retrieveProofOfPossessionNonce( - ...ResourceInstanceParameters, - - @doc("Proof of possession nonce request body ") - @body - @projectedName("python", "parameters") - proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, - ): ArmResponse | ErrorResponse; -} - -@doc("The properties of certificate") -model CertificateProperties { - @doc("The certificate as a UTF-8 encoded base 64 string.") - @visibility("read") - certificate?: string; - - @visibility("read") - @doc("The certificate status.") - status?: CertificateStatus; - - @visibility("read") - @doc("The certificate subject.") - subject?: string; - - @visibility("read") - @doc("The certificate thumbprint.") - thumbprint?: string; - - @visibility("read") - @doc("The certificate expiry date.") - expiryUtc?: utcDateTime; - - @visibility("read") - @doc("The certificate not before date.") - notBeforeUtc?: utcDateTime; - - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} - -@doc("The certificate chain response.") -model CertificateChainResponse { - @doc("The certificate chain.") - @visibility("read") - certificateChain?: string; -} - -@doc("Request for the proof of possession nonce") -model ProofOfPossessionNonceRequest { - @doc("The proof of possession nonce") - proofOfPossessionNonce: string; +interface Certificates { + /** + * Get a Certificate + */ + get is ArmResourceRead; + + /** + * List Certificate resources by Catalog + */ + listByCatalog is ArmResourceListByParent< + Certificate, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; + + /** + * Retrieves cert chain. + */ + retrieveCertChain is ArmResourceActionSync< + Certificate, + void, + CertificateChainResponse + >; + + /** + * Gets the proof of possession nonce. + */ + retrieveProofOfPossessionNonce is ArmResourceActionSync< + Certificate, + ProofOfPossessionNonceRequest, + ProofOfPossessionNonceResponse + >; } -@doc("Result of the action to generate a proof of possession nonce") -model ProofOfPossessionNonceResponse extends CertificateProperties {} +@@doc(Certificates.retrieveProofOfPossessionNonce::parameters.body, + "Proof of possession nonce request body " +); +@@encodedName(Certificates.retrieveProofOfPossessionNonce::parameters.body, + "application/json", + "proofOfPossessionNonceRequest" +); +@@extension(Certificates.retrieveProofOfPossessionNonce::parameters.body, + "x-ms-client-name", + "proofOfPossessionNonceRequest" +); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/common.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/common.tsp deleted file mode 100644 index 239b23b73fe..00000000000 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/common.tsp +++ /dev/null @@ -1,169 +0,0 @@ -import "@typespec/openapi"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; - -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; -using Azure.ResourceManager; -using OpenAPI; - -namespace Microsoft.AzureSphere; - -interface Operations extends Azure.ResourceManager.Operations {} - -// Common models -/** Provisioning state of the resource. */ -@lroStatus -enum ProvisioningState { - ...ResourceProvisioningState, - /** The resource is being provisioned */ - Provisioning, - /** The resource is being updated */ - Updating, - /** The resource is being deleted */ - Deleting, - /** The resource create request has been accepted */ - Accepted, -} - -@doc("Regional data boundary values.") -enum RegionalDataBoundary { - /** No data boundary */ - None, - /** EU data boundary */ - EU, -} - -@doc("Allow crash dumps values.") -enum AllowCrashDumpCollection { - /** Crash dump collection enabled */ - Enabled, - /** Crash dump collection disabled */ - Disabled, -} - -@doc("Certificate status values.") -enum CertificateStatus { - /** Certificate is active */ - Active, - /** Certificate is inactive */ - Inactive, - /** Certificate has expired */ - Expired, - /** Certificate has been revoked */ - Revoked, -} - -@doc("Provides the custom '$filter' query parameter for list operations") -model CustomFilterQueryParameter { - @query("$filter") - @doc("Filter the result list using the given expression") - filter?: string; -} - -@doc("Provides the custom '$top' query parameter for list operations.") -model CustomTopQueryParameter { - @query("$top") - @doc("The number of result items to return.") - top?: int32; -} - -@doc("Provides the custom '$skip' query parameter for list operations.") -model CustomSkipQueryParameter { - @query("$skip") - @doc("The number of result items to skip.") - skip?: int32; -} - -@doc("Provides the custom '$maxpagesize' query parameter for list operations.") -model CustomMaxPageSizeQueryParameter { - @query("$maxpagesize") - @doc("The maximum number of result items per page.") - maxpagesize?: int32; -} - -// @doc("Provides the most common query parameters for list operations.") -alias StandardListQueryParametersWithCorrectNames = { - ...CustomTopQueryParameter; - ...CustomSkipQueryParameter; - ...CustomMaxPageSizeQueryParameter; -}; - -@doc("Response to the action call for count devices in a catalog.") -model CountDeviceResponse extends CountElementsResponse {} - -@doc("Response of the count for elements.") -model CountElementsResponse { - @doc("Number of children resources in parent resource.") - value: int32; -} - -alias ListQueryParameters = { - ...CustomFilterQueryParameter; - ...StandardListQueryParametersWithCorrectNames; -}; - -// Templates -interface ProxyResourceOperationsReadList< - TResource extends ArmResource, - TListParameters extends {} = {} -> - extends Azure.ResourceManager.ResourceRead, - ResourceListByParent< - TResource, - TListParameters & BaseParameters - > {} - -interface ProxyResourceOperationsReadListCreateDelete< - TResource extends ArmResource, - TListParameters extends {} = {} -> - extends Azure.ResourceManager.ResourceRead, - ResourceListByParent< - TResource, - TListParameters & BaseParameters - >, - ResourceCreate, - Azure.ResourceManager.ResourceDelete {} - -// Custom update operations -@armResourceOperations -interface CustomUpdateOperations { - @autoRoute - @doc("Update a {name}", TResource) - @extension("x-ms-long-running-operation", true) - @extension( - "x-ms-long-running-operation-options", - { - `final-state-via`: "location", - } - ) - @armResourceUpdate(TResource) - @patch - ArmCustomPatchAsyncWithLocation< - TResource extends ArmResource, - TPatchModel extends TagsUpdateModel, - TBaseParameters = BaseParameters - >( - ...ResourceInstanceParameters, - - @doc("The resource properties to be updated.") - @body - properties: TPatchModel, - ): ArmResponse | ArmAcceptedResponse<"Resource update request accepted."> | ErrorResponse; -} - -alias CustomArmResourcePatchAsync< - TResource extends ArmResource, - TProperties extends {}, - TBaseParameters = BaseParameters -> = CustomUpdateOperations.ArmCustomPatchAsyncWithLocation< - TResource, - ResourceUpdateModel, - TBaseParameters ->; diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/deployment.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/deployment.tsp index 72009dc2f07..b45f84e756e 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/deployment.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/deployment.tsp @@ -1,63 +1,63 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./deviceGroup.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -// Deployment -@doc("An deployment resource belonging to a device group resource.") +/** + * An deployment resource belonging to a device group resource. + */ @parentResource(DeviceGroup) -model Deployment is ProxyResource { - @doc("Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group.") - @key("deploymentName") +model Deployment is Azure.ResourceManager.ProxyResource { + /** + * Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern" "existing api" @path + @key("deploymentName") @segment("deployments") + @visibility("read") name: string; } -interface ProxyResourceOperationsDeployments< - TResource extends ArmResource, - TListParameters extends {} = {} -> { - @doc("Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - get is ArmResourceRead; - @doc("List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - list is ArmResourceListByParent< - TResource, - ListQueryParameters & BaseParameters - >; - @doc("Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - createOrUpdate is ArmResourceCreateOrUpdateAsync; - @doc("Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - delete is ArmResourceDeleteAsync; -} - @armResourceOperations -interface Deployments extends ProxyResourceOperationsDeployments {} - -@doc("The properties of deployment") -model DeploymentProperties { - @visibility("create", "read") - @doc("Deployment ID") - deploymentId?: string; +interface Deployments { + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + get is ArmResourceRead; - @doc("Images deployed") - @visibility("create", "read") - deployedImages?: Image[]; + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; - @doc("Deployment date UTC") - @visibility("read") - deploymentDateUtc?: utcDateTime; + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + listByDeviceGroup is ArmResourceListByParent< + Deployment, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; } diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp index a8ed1a1f3e6..beb00e0ae23 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/device.tsp @@ -1,129 +1,86 @@ -import "@typespec/rest"; -import "@typespec/openapi"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./deviceGroup.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; -using OpenAPI; -using Azure.ClientGenerator.Core; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -// Devices -@doc("An device resource belonging to a device group resource.") +/** + * An device resource belonging to a device group resource. + */ @parentResource(DeviceGroup) -model Device is ProxyResource { - @doc("Device name") +model Device is Azure.ResourceManager.ProxyResource { + /** + * Device name + */ @pattern("^[a-zA-Z0-9-]{128}$") - @key("deviceName") @path + @key("deviceName") @segment("devices") + @visibility("read") name: string; } -interface ProxyResourceOperationsDevice< - TResource extends ArmResource, - TListParameters extends {} = {} -> { - @doc("Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product.") - get is ArmResourceRead; - @doc("Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only.") - createOrUpdate is ArmResourceCreateOrUpdateAsync; - @doc("List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - list is ArmResourceListByParent< - TResource, - TListParameters & BaseParameters - >; - delete is ArmResourceDeleteAsync; - @doc("Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level.") - update is CustomArmResourcePatchAsync; -} - @armResourceOperations -interface Devices extends ProxyResourceOperationsDevice { - @autoRoute - @armResourceAction(Device) - @post - @doc("Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product.") - @extension("x-ms-long-running-operation", true) - @extension( - "x-ms-long-running-operation-options", - { - `final-state-via`: "location", - } - ) - generateCapabilityImage( - ...ResourceInstanceParameters, - - @doc("Generate capability image request body.") - @body - @projectedName("python", "parameters") - generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, - ): ArmResponse | ArmAcceptedResponse | ErrorResponse; -} - -@doc("The properties of device") -model DeviceProperties { - @doc("Device ID") - @visibility("create", "read") - deviceId?: string; - - @doc("SKU of the chip") - @visibility("read") - chipSku?: string; - - @doc("OS version available for installation when update requested") - @visibility("read") - lastAvailableOsVersion?: string; - - @doc("OS version running on device when update requested") - @visibility("read") - lastInstalledOsVersion?: string; - - @doc("Time when update requested and new OS version available") - @visibility("read") - lastOsUpdateUtc?: utcDateTime; - - @doc("Time when update was last requested") - @visibility("read") - lastUpdateRequestUtc?: utcDateTime; - - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} +interface Devices { + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. + */ + get is ArmResourceRead; -// Device models -@doc("Request of the action to create a signed device capability image") -model GenerateCapabilityImageRequest { - @doc("List of capabilities to create") - capabilities: CapabilityType[]; -} + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "Existing API" + @parameterVisibility + update is ArmCustomPatchAsync< + Device, + DeviceUpdate, + LroHeaders = Azure.Core.Foundations.RetryAfterHeader + >; -@doc("Signed device capability image response") -model SignedCapabilityImageResponse { - @doc("The signed device capability image as a UTF-8 encoded base 64 string.") - @visibility("read") - image?: string; -} + /** + * Delete a Device + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; -@doc("Capability image type") -enum CapabilityType { - /** Application development capability */ - ApplicationDevelopment, - /** Field servicing capability */ - FieldServicing, + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + listByDeviceGroup is ArmResourceListByParent; + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. + */ + generateCapabilityImage is ArmResourceActionAsync< + Device, + GenerateCapabilityImageRequest, + SignedCapabilityImageResponse + >; } -@doc("The properties of device patch") -model DevicePatchProperties { - @doc("Device group id") - deviceGroupId: string; -} +@@doc(Devices.generateCapabilityImage::parameters.body, + "Generate capability image request body." +); +@@encodedName(Devices.generateCapabilityImage::parameters.body, + "application/json", + "generateDeviceCapabilityRequest" +); +@@extension(Devices.generateCapabilityImage::parameters.body, + "x-ms-client-name", + "generateDeviceCapabilityRequest" +); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp index acb3c5bbe5e..d050170ec64 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/deviceGroup.tsp @@ -1,129 +1,98 @@ -import "@typespec/rest"; -import "@typespec/openapi"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./product.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; -using OpenAPI; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -@doc("An device group resource belonging to a product resource.") +/** + * An device group resource belonging to a product resource. + */ @parentResource(Product) -model DeviceGroup is ProxyResource { - @doc("Name of device group.") +model DeviceGroup is Azure.ResourceManager.ProxyResource { + /** + * Name of device group. + */ @pattern("^[A-Za-z0-9]{1,2}$|^[A-Za-z0-9][A-Za-z0-9\\s]{1,48}[A-Za-z0-9]$|^\\.default$|^\\.unassigned$") - @key("deviceGroupName") @path + @key("deviceGroupName") @segment("deviceGroups") + @visibility("read") name: string; } -interface ProxyResourceOperationsDeviceGroups< - TResource extends ArmResource, - TListParameters extends {} = {} -> { - @doc("List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - list is ArmResourceListByParent< - TResource, - TListParameters & BaseParameters - >; - @doc("Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") +@armResourceOperations +interface DeviceGroups { + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ get is ArmResourceRead; - @doc("Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - createOrUpdate is ArmResourceCreateOrUpdateAsync; - @doc("Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - delete is ArmResourceDeleteAsync; - @doc("Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - update is ArmResourcePatchAsync; -} -@armResourceOperations -interface DeviceGroups - extends ProxyResourceOperationsDeviceGroups< - DeviceGroup, - ListQueryParameters - > { - @autoRoute - @doc("Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name.") - @armResourceAction(DeviceGroup) - @post - countDevices( - ...ResourceInstanceParameters, - ): ArmResponse | ErrorResponse; + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + @parameterVisibility + update is ArmCustomPatchAsync; + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; - @autoRoute - @armResourceAction(DeviceGroup) - @doc("Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only.") - @extension("x-ms-long-running-operation", true) - @extension( - "x-ms-long-running-operation-options", + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + listByProduct is ArmResourceListByParent< + DeviceGroup, { - `final-state-via`: "location", + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; } - ) - @post - claimDevices( - ...ResourceInstanceParameters, - - @doc("Bulk claim devices request body.") - @body - claimDevicesRequest: ClaimDevicesRequest, - ): ArmAcceptedResponse | ErrorResponse; -} - -@doc("The properties of deviceGroup") -model DeviceGroupProperties { - @doc("Description of the device group.") - description?: string; - - @doc("Operating system feed type of the device group.") - osFeedType?: OSFeedType; - - @doc("Update policy of the device group.") - updatePolicy?: UpdatePolicy; - - @doc("Flag to define if the user allows for crash dump collection.") - allowCrashDumpsCollection?: AllowCrashDumpCollection; - - @doc("Regional data boundary for the device group.") - regionalDataBoundary?: RegionalDataBoundary; - - @visibility("read") - @doc("Deployment status for the device group.") - hasDeployment?: boolean; - - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} + >; -@doc("OS feed type values.") -enum OSFeedType { - /** Retail OS feed type. */ - Retail, - /** Retail evaluation OS feed type. */ - RetailEval, -} + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. + */ + claimDevices is ArmResourceActionNoResponseContentAsync< + DeviceGroup, + ClaimDevicesRequest + >; -@doc("Update policy values.") -enum UpdatePolicy { - /** Update all policy. */ - UpdateAll, - /** No update for 3rd party app policy. */ - No3rdPartyAppUpdates, + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + */ + countDevices is ArmResourceActionSync< + DeviceGroup, + void, + CountDevicesResponse + >; } -// Device group models - -@doc("Request to the action call to bulk claim devices.") -model ClaimDevicesRequest { - @doc("Device identifiers of the devices to be claimed.") - deviceIdentifiers: string[]; -} +@@doc(DeviceGroups.claimDevices::parameters.body, + "Bulk claim devices request body." +); +@@encodedName(DeviceGroups.claimDevices::parameters.body, + "application/json", + "claimDevicesRequest" +); +@@extension(DeviceGroups.claimDevices::parameters.body, + "x-ms-client-name", + "claimDevicesRequest" +); diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/image.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/image.tsp index 16c445ed83a..1602999d0c1 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/image.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/image.tsp @@ -1,128 +1,63 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./catalog.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -//Images -@doc("An image resource belonging to a catalog resource.") +/** + * An image resource belonging to a catalog resource. + */ @parentResource(Catalog) -model Image is ProxyResource { - @doc("Image name. Use .default for image creation.") - @key("imageName") +model Image is Azure.ResourceManager.ProxyResource { + /** + * Image name. Use an image GUID for GA versions of the API. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern" "existing api" @path + @key("imageName") @segment("images") + @visibility("read") name: string; } @armResourceOperations -interface Images - extends ProxyResourceOperationsReadListCreateDelete< - Image, - ListQueryParameters - > {} - -@doc("The properties of image") -model ImageProperties { - @doc("Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads.") - @visibility("create", "read") - image?: string; - - @doc("Image ID") - @visibility("create", "read") - imageId?: string; - - @doc("Image name") - @visibility("read") - imageName?: string; - - @doc("Regional data boundary for an image") - @visibility("create", "read") - regionalDataBoundary?: RegionalDataBoundary; - - @doc("Location the image") - @visibility("read") - uri?: string; - - @doc("The image description.") - @visibility("read") - description?: string; - - @doc("The image component id.") - @visibility("read") - componentId?: string; - - @doc("The image type.") - @visibility("read") - imageType?: ImageType; - - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; -} - -@doc("Image upload request body.") -model ImageUploadRequestBody { - @doc(".") - images: string; -} - -@doc("Image type values.") -enum ImageType { - /** Invalid image. */ - InvalidImageType, - /** One Bl image type */ - OneBl, - /** Pluton image type */ - PlutonRuntime, - /** Wifi firmware image type */ - WifiFirmware, - /** Security monitor image type */ - SecurityMonitor, - /** Normal world loader image type */ - NormalWorldLoader, - /** Normal world dtb image type */ - NormalWorldDtb, - /** Normal world kernel image type */ - NormalWorldKernel, - /** Root FS image type */ - RootFs, - /** Services image type */ - Services, - /** Applications image type */ - Applications, - /** FW config image type */ - FwConfig, - /** Boot manifest image type */ - BootManifest, - /** Nwfs image type */ - Nwfs, - /** Trusted key store image type */ - TrustedKeystore, - /** Policy image type */ - Policy, - /** Customer board config image type */ - CustomerBoardConfig, - /** Update certificate store image type */ - UpdateCertStore, - /** Base system update manifest image type */ - BaseSystemUpdateManifest, - /** Firmware update manifest image type */ - FirmwareUpdateManifest, - /** Customer update manifest image type */ - CustomerUpdateManifest, - /** Recovery manifest image type */ - RecoveryManifest, - /** manifest set image type */ - ManifestSet, - /** Other image type */ - Other, +interface Images { + /** + * Get a Image + */ + get is ArmResourceRead; + + /** + * Create a Image + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + /** + * Delete a Image + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; + + /** + * List Image resources by Catalog + */ + listByCatalog is ArmResourceListByParent< + Image, + { + ...BaseParameters; + ...CustomFilterQueryParameter; + ...CustomTopQueryParameter; + ...CustomSkipQueryParameter; + ...CustomMaxPageSizeQueryParameter; + } + >; } diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/main.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/main.tsp index 7bd635ad2bb..c169d0c5d98 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/main.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/main.tsp @@ -1,30 +1,41 @@ -import "./common.tsp"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "./models.tsp"; import "./catalog.tsp"; +import "./certificate.tsp"; import "./image.tsp"; +import "./product.tsp"; import "./deviceGroup.tsp"; -import "./certificate.tsp"; import "./deployment.tsp"; import "./device.tsp"; -import "./deviceGroup.tsp"; -import "./product.tsp"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; +using TypeSpec.Http; using Azure.ResourceManager.Foundations; using Azure.Core; using Azure.ResourceManager; - +using TypeSpec.Versioning; +/** + * Azure Sphere resource management API. + */ @armProviderNamespace @service({ title: "AzureSphereProviderClient", - version: "2022-09-01-preview", }) -@doc("Azure Sphere resource management API.") -@useDependency(Azure.Core.Versions.v1_0_Preview_1) -@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@versioned(Versions) +@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) namespace Microsoft.AzureSphere; + +/** + * The available API versions. + */ +enum Versions { + /** + * The 2024-04-01 API version. + */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @useDependency(Azure.Core.Versions.v1_0_Preview_1) + v2024_04_01: "2024-04-01", +} diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/models.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/models.tsp new file mode 100644 index 00000000000..750a50b85fb --- /dev/null +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/models.tsp @@ -0,0 +1,865 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; +using OpenAPI; + +namespace Microsoft.AzureSphere; + +interface Operations extends Azure.ResourceManager.Operations {} + +/** + * Provisioning state of resource. + */ +union ProvisioningState { + string, + + /** + * Resource has been created. + */ + Succeeded: "Succeeded", + + /** + * Resource creation failed. + */ + Failed: "Failed", + + /** + * Resource creation was canceled. + */ + Canceled: "Canceled", + + /** + * The resource is being provisioned + */ + Provisioning: "Provisioning", + + /** + * The resource is being updated + */ + Updating: "Updating", + + /** + * The resource is being deleted + */ + Deleting: "Deleting", + + /** + * The resource create request has been accepted + */ + Accepted: "Accepted", +} + +/** + * Certificate status values. + */ +union CertificateStatus { + string, + + /** + * Certificate is active + */ + Active: "Active", + + /** + * Certificate is inactive + */ + Inactive: "Inactive", + + /** + * Certificate has expired + */ + Expired: "Expired", + + /** + * Certificate has been revoked + */ + Revoked: "Revoked", +} + +/** + * Regional data boundary values. + */ +union RegionalDataBoundary { + string, + + /** + * No data boundary + */ + None: "None", + + /** + * EU data boundary + */ + EU: "EU", +} + +/** + * Image type values. + */ +union ImageType { + string, + + /** + * Invalid image. + */ + InvalidImageType: "InvalidImageType", + + /** + * One Bl image type + */ + OneBl: "OneBl", + + /** + * Pluton image type + */ + PlutonRuntime: "PlutonRuntime", + + /** + * Wifi firmware image type + */ + WifiFirmware: "WifiFirmware", + + /** + * Security monitor image type + */ + SecurityMonitor: "SecurityMonitor", + + /** + * Normal world loader image type + */ + NormalWorldLoader: "NormalWorldLoader", + + /** + * Normal world dtb image type + */ + NormalWorldDtb: "NormalWorldDtb", + + /** + * Normal world kernel image type + */ + NormalWorldKernel: "NormalWorldKernel", + + /** + * Root FS image type + */ + RootFs: "RootFs", + + /** + * Services image type + */ + Services: "Services", + + /** + * Applications image type + */ + Applications: "Applications", + + /** + * FW config image type + */ + FwConfig: "FwConfig", + + /** + * Boot manifest image type + */ + BootManifest: "BootManifest", + + /** + * Nwfs image type + */ + Nwfs: "Nwfs", + + /** + * Trusted key store image type + */ + TrustedKeystore: "TrustedKeystore", + + /** + * Policy image type + */ + Policy: "Policy", + + /** + * Customer board config image type + */ + CustomerBoardConfig: "CustomerBoardConfig", + + /** + * Update certificate store image type + */ + UpdateCertStore: "UpdateCertStore", + + /** + * Base system update manifest image type + */ + BaseSystemUpdateManifest: "BaseSystemUpdateManifest", + + /** + * Firmware update manifest image type + */ + FirmwareUpdateManifest: "FirmwareUpdateManifest", + + /** + * Customer update manifest image type + */ + CustomerUpdateManifest: "CustomerUpdateManifest", + + /** + * Recovery manifest image type + */ + RecoveryManifest: "RecoveryManifest", + + /** + * manifest set image type + */ + ManifestSet: "ManifestSet", + + /** + * Other image type + */ + Other: "Other", +} + +/** + * OS feed type values. + */ +union OSFeedType { + string, + + /** + * Retail OS feed type. + */ + Retail: "Retail", + + /** + * Retail evaluation OS feed type. + */ + RetailEval: "RetailEval", +} + +/** + * Update policy values. + */ +union UpdatePolicy { + string, + + /** + * Update all policy. + */ + UpdateAll: "UpdateAll", + + /** + * No update for 3rd party app policy. + */ + No3rdPartyAppUpdates: "No3rdPartyAppUpdates", +} + +/** + * Allow crash dumps values. + */ +union AllowCrashDumpCollection { + string, + + /** + * Crash dump collection enabled + */ + Enabled: "Enabled", + + /** + * Crash dump collection disabled + */ + Disabled: "Disabled", +} + +/** + * Capability image type + */ +union CapabilityType { + string, + + /** + * Application development capability + */ + ApplicationDevelopment: "ApplicationDevelopment", + + /** + * Field servicing capability + */ + FieldServicing: "FieldServicing", +} + +/** + * Catalog properties + */ +model CatalogProperties { + /** + * The Azure Sphere tenant ID associated with the catalog. + */ + @visibility("read") + tenantId?: string; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * Common fields that are returned in the response for all Azure Resource Manager resources + */ +model Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + */ + @visibility("read") + id?: string; + + /** + * The name of the resource + */ + @visibility("read") + name?: string; + + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + */ + @visibility("read") + type?: string; + + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @visibility("read") + systemData?: SystemData; +} + +/** + * The type used for update operations of the Catalog. + */ +model CatalogUpdate { + /** + * Resource tags. + */ + tags?: Record; +} + +/** + * The properties of certificate + */ +model CertificateProperties { + /** + * The certificate as a UTF-8 encoded base 64 string. + */ + @visibility("read") + certificate?: string; + + /** + * The certificate status. + */ + @visibility("read") + status?: CertificateStatus; + + /** + * The certificate subject. + */ + @visibility("read") + subject?: string; + + /** + * The certificate thumbprint. + */ + @visibility("read") + thumbprint?: string; + + /** + * The certificate expiry date. + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + expiryUtc?: utcDateTime; + + /** + * The certificate not before date. + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + notBeforeUtc?: utcDateTime; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * The certificate chain response. + */ +model CertificateChainResponse { + /** + * The certificate chain. + */ + @visibility("read") + certificateChain?: string; +} + +/** + * Request for the proof of possession nonce + */ +model ProofOfPossessionNonceRequest { + /** + * The proof of possession nonce + */ + proofOfPossessionNonce: string; +} + +/** + * Result of the action to generate a proof of possession nonce + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatible" +model ProofOfPossessionNonceResponse extends CertificateProperties {} + +/** + * Response to the action call for count devices in a catalog. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatible" +model CountDevicesResponse extends CountElementsResponse {} + +/** + * Response of the count for elements. + */ +model CountElementsResponse { + /** + * Number of children resources in parent resource. + */ + value: int32; +} + +/** + * The properties of image + */ +model ImageProperties { + /** + * Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads. + */ + @visibility("read", "create") + image?: string; + + /** + * Image ID + */ + @visibility("read", "create") + imageId?: string; + + /** + * Image name + */ + @visibility("read") + imageName?: string; + + /** + * Regional data boundary for an image + */ + @visibility("read", "create") + regionalDataBoundary?: RegionalDataBoundary; + + /** + * Location the image + */ + @visibility("read") + uri?: string; + + /** + * The image description. + */ + @visibility("read") + description?: string; + + /** + * The image component id. + */ + @visibility("read") + componentId?: string; + + /** + * The image type. + */ + @visibility("read") + imageType?: ImageType; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * The properties of deployment + */ +model DeploymentProperties { + /** + * Deployment ID + */ + @visibility("read", "create") + deploymentId?: string; + + /** + * Images deployed + */ + @visibility("read", "create") + deployedImages?: Image[]; + + /** + * Deployment date UTC + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + deploymentDateUtc?: utcDateTime; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * Request of the action to list device groups for a catalog. + */ +model ListDeviceGroupsRequest { + /** + * Device Group name. + */ + deviceGroupName?: string; +} + +/** + * The properties of deviceGroup + */ +model DeviceGroupProperties { + /** + * Description of the device group. + */ + description?: string; + + /** + * Operating system feed type of the device group. + */ + osFeedType?: OSFeedType; + + /** + * Update policy of the device group. + */ + updatePolicy?: UpdatePolicy; + + /** + * Flag to define if the user allows for crash dump collection. + */ + allowCrashDumpsCollection?: AllowCrashDumpCollection; + + /** + * Regional data boundary for the device group. + */ + regionalDataBoundary?: RegionalDataBoundary; + + /** + * Deployment status for the device group. + */ + @visibility("read") + hasDeployment?: boolean; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * Paged collection of DeviceInsight items + */ +model PagedDeviceInsight is Azure.Core.Page; + +/** + * Device insight report. + */ +model DeviceInsight { + /** + * Device ID + */ + deviceId: string; + + /** + * Event description + */ + description: string; + + /** + * Event start timestamp + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + startTimestampUtc: utcDateTime; + + /** + * Event end timestamp + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + endTimestampUtc: utcDateTime; + + /** + * Event category + */ + eventCategory: string; + + /** + * Event class + */ + eventClass: string; + + /** + * Event type + */ + eventType: string; + + /** + * Event count + */ + eventCount: int32; +} + +/** + * The properties of device + */ +model DeviceProperties { + /** + * Device ID + */ + @visibility("read", "create") + deviceId?: string; + + /** + * SKU of the chip + */ + @visibility("read") + chipSku?: string; + + /** + * OS version available for installation when update requested + */ + @visibility("read") + lastAvailableOsVersion?: string; + + /** + * OS version running on device when update requested + */ + @visibility("read") + lastInstalledOsVersion?: string; + + /** + * Time when update requested and new OS version available + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + lastOsUpdateUtc?: utcDateTime; + + /** + * Time when update was last requested + */ + @visibility("read") + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + lastUpdateRequestUtc?: utcDateTime; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * The properties of product + */ +model ProductProperties { + /** + * Description of the product + */ + description?: string; + + /** + * The status of the last operation. + */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** + * The type used for update operations of the Product. + */ +model ProductUpdate { + /** + * The updatable properties of the Product. + */ + @extension("x-ms-client-flatten", true) + properties?: ProductUpdateProperties; +} + +/** + * The updatable properties of the Product. + */ +model ProductUpdateProperties { + /** + * Description of the product + */ + description?: string; +} + +/** + * The type used for update operations of the DeviceGroup. + */ +model DeviceGroupUpdate { + /** + * The updatable properties of the DeviceGroup. + */ + @extension("x-ms-client-flatten", true) + properties?: DeviceGroupUpdateProperties; +} + +/** + * The updatable properties of the DeviceGroup. + */ +model DeviceGroupUpdateProperties { + /** + * Description of the device group. + */ + description?: string; + + /** + * Operating system feed type of the device group. + */ + osFeedType?: OSFeedType; + + /** + * Update policy of the device group. + */ + updatePolicy?: UpdatePolicy; + + /** + * Flag to define if the user allows for crash dump collection. + */ + allowCrashDumpsCollection?: AllowCrashDumpCollection; + + /** + * Regional data boundary for the device group. + */ + regionalDataBoundary?: RegionalDataBoundary; +} + +/** + * Request to the action call to bulk claim devices. + */ +model ClaimDevicesRequest { + /** + * Device identifiers of the devices to be claimed. + */ + deviceIdentifiers: string[]; +} + +/** + * The type used for update operations of the Device. + */ +model DeviceUpdate { + /** + * The updatable properties of the Device. + */ + @extension("x-ms-client-flatten", true) + properties?: DeviceUpdateProperties; +} + +/** + * The updatable properties of the Device. + */ +model DeviceUpdateProperties { + /** + * Device group id + */ + deviceGroupId?: string; +} + +/** + * Request of the action to create a signed device capability image + */ +model GenerateCapabilityImageRequest { + /** + * List of capabilities to create + */ + capabilities: CapabilityType[]; +} + +/** + * Signed device capability image response + */ +model SignedCapabilityImageResponse { + /** + * The signed device capability image as a UTF-8 encoded base 64 string. + */ + @visibility("read") + image?: string; +} + +/** + * Response to the action call for count devices in a catalog (preview API). + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatible" +model CountDeviceResponse extends CountElementsResponse {} + +/** + * Provides the custom '$filter' query parameter for list operations + */ +model CustomFilterQueryParameter { + /** + * Filter the result list using the given expression + */ + @query("$filter") + filter?: string; +} + +/** + * Provides the custom '$top' query parameter for list operations. + */ +model CustomTopQueryParameter { + /** + * The number of result items to return. + */ + @query("$top") + top?: int32; +} + +/** + * Provides the custom '$skip' query parameter for list operations. + */ +model CustomSkipQueryParameter { + /** + * The number of result items to skip. + */ + @query("$skip") + skip?: int32; +} + +/** + * Provides the custom '$maxpagesize' query parameter for list operations. + */ +model CustomMaxPageSizeQueryParameter { + /** + * The maximum number of result items per page. + */ + @query("$maxpagesize") + maxpagesize?: int32; +} diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp b/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp index 09d6c83c9da..fd663a74bb1 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/product.tsp @@ -1,72 +1,74 @@ -import "@typespec/rest"; -import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; +import "@typespec/rest"; +import "./models.tsp"; +import "./catalog.tsp"; -using TypeSpec.Http; using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.ResourceManager.Foundations; -using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Foundations; +using TypeSpec.Http; +using TypeSpec.OpenAPI; namespace Microsoft.AzureSphere; - -//Products -@doc("An product resource belonging to a catalog resource.") +/** + * An product resource belonging to a catalog resource. + */ @parentResource(Catalog) -model Product is ProxyResource { - @doc("Name of product.") +model Product is Azure.ResourceManager.ProxyResource { + /** + * Name of product. + */ @pattern("^[\\w][\\w\\s]{1,48}[\\w]$|^\\.default$|^\\.unassigned$") - @key("productName") @path + @key("productName") @segment("products") + @visibility("read") name: string; } -interface ProxyResourceOperationsProducts< - TResource extends ArmResource, - TListParameters extends {} = {} -> - extends ResourceListByParent< - TResource, - TListParameters & BaseParameters - > { - @doc("Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") +@armResourceOperations +interface Products { + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ get is ArmResourceRead; - @doc("Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - createOrUpdate is ArmResourceCreateOrUpdateAsync; - @doc("Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'") - delete is ArmResourceDeleteAsync; - @doc("Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - update is ArmResourcePatchAsync; -} -@armResourceOperations -interface Products extends ProxyResourceOperationsProducts { - @autoRoute - @doc("Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - @armResourceAction(Product) - @post - generateDefaultDeviceGroups( - ...ResourceInstanceParameters, - ): ArmResponse> | ErrorResponse; + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + createOrUpdate is ArmResourceCreateOrReplaceAsync; - @autoRoute - @doc("Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name.") - @armResourceAction(Product) - @post - countDevices( - ...ResourceInstanceParameters, - ): ArmResponse | ErrorResponse; -} + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + @parameterVisibility + update is ArmCustomPatchAsync; -@doc("The properties of product") -model ProductProperties { - @doc("Description of the product") - description: string; + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' + */ + #suppress "deprecated" "For backward compatible" + #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatible" + delete is ArmResourceDeleteAsync; - @visibility("read") - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; + /** + * List Product resources by Catalog + */ + listByCatalog is ArmResourceListByParent; + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + countDevices is ArmResourceActionSync; + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + */ + generateDefaultDeviceGroups is ArmResourceActionSync< + Product, + void, + ResourceListResult + >; } diff --git a/packages/typespec-python/test/azure/specification/mgmt/sphere/tspconfig.yaml b/packages/typespec-python/test/azure/specification/mgmt/sphere/tspconfig.yaml index dc225dbf530..e00a4055bc4 100644 --- a/packages/typespec-python/test/azure/specification/mgmt/sphere/tspconfig.yaml +++ b/packages/typespec-python/test/azure/specification/mgmt/sphere/tspconfig.yaml @@ -1,7 +1,8 @@ emit: - - '@azure-tools/typespec-autorest' + - "@azure-tools/typespec-autorest" options: - '@azure-tools/typespec-autorest': + "@azure-tools/typespec-autorest": + omit-unreachable-types: true emitter-output-dir: "{project-root}/.." azure-resource-provider-folder: "resource-manager" output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/azuresphere.json" @@ -14,4 +15,7 @@ options: save-inputs: false clear-output-folder: true namespace: Azure.Sphere - model-namespace: false \ No newline at end of file + model-namespace: false +linter: + extends: + - "@azure-tools/typespec-azure-resource-manager/all" diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py index 85d7e471933..17cb4b64ced 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py @@ -25,6 +25,7 @@ from .. import models as _models from .._model_base import _deserialize from .._serialization import Serializer +from .._validation import api_version_validation from .._vendor import PageableClientMixinABC if sys.version_info >= (3, 9): @@ -59,6 +60,9 @@ def build_pageable_list_request(*, maxpagesize: Optional[int] = None, **kwargs: class PageableClientOperationsMixin(PageableClientMixinABC): + @api_version_validation( + params_added_on={"1.0-preview.1": ["maxpagesize"]}, + ) def list(self, **kwargs: Any) -> Iterable["_models.User"]: """List users. diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_validation.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_validation.py new file mode 100644 index 00000000000..59609bcd4fe --- /dev/null +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_validation.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Unbranded Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Unbranded (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if method_added_on > client_api_version: + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and api_version > client_api_version + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py index 8fa63322568..cc4196b8fdc 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py @@ -24,6 +24,7 @@ from ... import models as _models from ..._model_base import _deserialize from ..._operations._operations import build_pageable_list_request +from ..._validation import api_version_validation from .._vendor import PageableClientMixinABC if sys.version_info >= (3, 9): @@ -36,6 +37,9 @@ class PageableClientOperationsMixin(PageableClientMixinABC): + @api_version_validation( + params_added_on={"1.0-preview.1": ["maxpagesize"]}, + ) def list(self, **kwargs: Any) -> AsyncIterable["_models.User"]: """List users. diff --git a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py index 5156d246645..cd6f54f107c 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/aio/operations/_operations.py @@ -61,8 +61,8 @@ def __init__(self, *args, **kwargs) -> None: @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -98,8 +98,8 @@ async def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: JSON, *, content_type: str = "application/json", **kwargs: Any @@ -128,8 +128,8 @@ async def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -157,8 +157,8 @@ async def v2_in_interface( """ @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -247,8 +247,7 @@ class AddedClientOperationsMixin(AddedClientMixinABC): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: _models.ModelV1, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -288,8 +287,7 @@ async def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: JSON, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -321,8 +319,7 @@ async def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: IO[bytes], *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -353,8 +350,7 @@ async def v1( """ @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) async def v1( self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, **kwargs: Any @@ -447,7 +443,8 @@ async def v1( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -483,7 +480,8 @@ async def v2( @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -510,7 +508,8 @@ async def v2(self, body: JSON, *, content_type: str = "application/json", **kwar @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -536,7 +535,8 @@ async def v2(self, body: IO[bytes], *, content_type: str = "application/json", * """ @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) async def v2(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2. diff --git a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py index 69aca7e20ff..0e438122aa5 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/versioning-added/versioning/added/operations/_operations.py @@ -112,8 +112,8 @@ def __init__(self, *args, **kwargs): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface( self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any @@ -149,8 +149,8 @@ def v2_in_interface( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -177,8 +177,8 @@ def v2_in_interface(self, body: JSON, *, content_type: str = "application/json", @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -206,8 +206,8 @@ def v2_in_interface( """ @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2_in_interface(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2_in_interface. @@ -296,8 +296,7 @@ class AddedClientOperationsMixin(AddedClientMixinABC): @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: _models.ModelV1, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -337,8 +336,7 @@ def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: JSON, *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -370,8 +368,7 @@ def v1( @overload @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1( self, body: IO[bytes], *, header_v2: str, content_type: str = "application/json", **kwargs: Any @@ -402,8 +399,7 @@ def v1( """ @api_version_validation( - method_added_on="v1", - params_added_on={"v1": ["endpoint", "version", "content_type", "accept"]}, + params_added_on={"v2": ["header_v2"]}, ) def v1(self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, **kwargs: Any) -> _models.ModelV1: """v1. @@ -494,7 +490,8 @@ def v1(self, body: Union[_models.ModelV1, JSON, IO[bytes]], *, header_v2: str, * @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: _models.ModelV2, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -528,7 +525,8 @@ def v2(self, body: _models.ModelV2, *, content_type: str = "application/json", * @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -555,7 +553,8 @@ def v2(self, body: JSON, *, content_type: str = "application/json", **kwargs: An @overload @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.ModelV2: """v2. @@ -581,7 +580,8 @@ def v2(self, body: IO[bytes], *, content_type: str = "application/json", **kwarg """ @api_version_validation( - params_added_on={"v1": ["endpoint", "version", "content_type"]}, + method_added_on="v2", + params_added_on={"v2": ["content_type", "accept"]}, ) def v2(self, body: Union[_models.ModelV2, JSON, IO[bytes]], **kwargs: Any) -> _models.ModelV2: """v2. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index adcf9442380..fad4c90a4c3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,5 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - importers: .: @@ -61,30 +57,30 @@ importers: specifier: workspace:^ version: link:../autorest.python '@typespec/openapi3': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/versioning@0.56.0) js-yaml: specifier: ~4.1.0 version: 4.1.0 devDependencies: '@azure-tools/cadl-ranch-expect': - specifier: ~0.13.3 - version: 0.13.3(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.13.4 + version: 0.13.4(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/cadl-ranch-specs': - specifier: ~0.33.2 - version: 0.33.2(@azure-tools/cadl-ranch-expect@0.13.3)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.33.4 + version: 0.33.4(@azure-tools/cadl-ranch-expect@0.13.4)(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/typespec-autorest': - specifier: ~0.41.0 - version: 0.41.0(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.8)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.42.0 + version: 0.42.0(@azure-tools/typespec-azure-core@0.42.0)(@azure-tools/typespec-client-generator-core@0.42.2)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/typespec-azure-core': - specifier: ~0.41.0 - version: 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) + specifier: ~0.42.0 + version: 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) '@azure-tools/typespec-azure-resource-manager': - specifier: ~0.41.0 - version: 0.41.0(@azure-tools/typespec-autorest@0.41.0)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.42.0 + version: 0.42.0(@azure-tools/typespec-autorest@0.42.0)(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@azure-tools/typespec-client-generator-core': - specifier: ~0.41.8 - version: 0.41.8(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + specifier: ~0.42.2 + version: 0.42.2(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) '@types/js-yaml': specifier: ~4.0.5 version: 4.0.5 @@ -95,29 +91,29 @@ importers: specifier: ^18.16.3 version: 18.16.3 '@typespec/compiler': - specifier: ~0.55.0 - version: 0.55.0 + specifier: ~0.56.0 + version: 0.56.0 '@typespec/eslint-config-typespec': specifier: ~0.55.0 version: 0.55.0(prettier@3.2.5) '@typespec/http': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.56.0) '@typespec/openapi': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) '@typespec/rest': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) '@typespec/versioning': - specifier: ~0.55.0 - version: 0.55.0(@typespec/compiler@0.55.0) + specifier: ~0.56.0 + version: 0.56.0(@typespec/compiler@0.56.0) c8: specifier: ~7.13.0 version: 7.13.0 eslint: - specifier: ^8.56.0 - version: 8.56.0 + specifier: ^8.57.0 + version: 8.57.0 mocha: specifier: ~10.2.0 version: 10.2.0 @@ -209,25 +205,40 @@ packages: '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) dev: true - /@azure-tools/cadl-ranch-specs@0.33.2(@azure-tools/cadl-ranch-expect@0.13.3)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-goFLjvXGeOC+r5oCOhI3csuWqQFPGO4iuhLdGmjyyB2YDiiNTdKXV19hyGVM2FYeHvmmgElBHdHY6E49+Z6wkw==} + /@azure-tools/cadl-ranch-expect@0.13.4(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-2j9Mxr8tz7zF8j8L/R/KEPhES/cJDt21wUTkQv0TKwZ4Kz5HGHBCsvnOnoBs72H7Q8DHpqOIhNDak40BHCrEGA==} engines: {node: '>=16.0.0'} peerDependencies: - '@azure-tools/cadl-ranch-expect': ~0.13.3 - '@azure-tools/typespec-azure-core': ~0.41.0 - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/rest': ~0.55.0 - '@typespec/versioning': ~0.55.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 dependencies: - '@azure-tools/cadl-ranch': 0.12.7(@typespec/versioning@0.55.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) + dev: true + + /@azure-tools/cadl-ranch-specs@0.33.4(@azure-tools/cadl-ranch-expect@0.13.4)(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-xTTyZIWT8bjXNoFr1M5CA6L7yo3mLBMzSDYPepCCWk3Wx8P2bl0NkK9YS4udfTA9TKlUJPSW23DvHcQfJ2rurQ==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@azure-tools/cadl-ranch-expect': ~0.13.4 + '@azure-tools/typespec-azure-core': ~0.42.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@azure-tools/cadl-ranch': 0.12.8(@typespec/versioning@0.56.0) '@azure-tools/cadl-ranch-api': 0.4.3 - '@azure-tools/cadl-ranch-expect': 0.13.3(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) - '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@azure-tools/cadl-ranch-expect': 0.13.4(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@azure-tools/typespec-azure-core': 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) transitivePeerDependencies: - '@types/express' - encoding @@ -270,76 +281,114 @@ packages: - supports-color dev: true - /@azure-tools/typespec-autorest@0.41.0(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.8)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-yMbzIXKO7jH2+w69nhrQoq6tsvEls1rP62bBduFNY8wGsYNirTnbyRoRmP42gG2cGoa9uXcol9fCprarKysXCw==} - engines: {node: '>=18.0.0'} - peerDependencies: - '@azure-tools/typespec-azure-core': ~0.41.0 - '@azure-tools/typespec-client-generator-core': ~0.41.0 - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/openapi': ~0.55.0 - '@typespec/rest': ~0.55.0 - '@typespec/versioning': ~0.55.0 + /@azure-tools/cadl-ranch@0.12.8(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-dkVz6YxwFBgwmWtYqpzY1cuncuuHcvQbd8gHx1j9tvl8VjEjd5gVTAEFkp9ZuOM8P9L/VP5x4q14RlRMOMitHQ==} + engines: {node: '>=16.0.0'} + hasBin: true dependencies: - '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) - '@azure-tools/typespec-client-generator-core': 0.41.8(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@azure-tools/cadl-ranch-api': 0.4.3 + '@azure-tools/cadl-ranch-coverage-sdk': 0.8.2 + '@azure-tools/cadl-ranch-expect': 0.13.4(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@azure/identity': 3.4.2 + '@types/js-yaml': 4.0.9 + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + ajv: 8.12.0 + body-parser: 1.20.2 + deep-equal: 2.2.3 + express: 4.19.2 + express-promise-router: 4.1.1(express@4.19.2) + glob: 10.3.12 + jackspeak: 2.1.1 + js-yaml: 4.1.0 + morgan: 1.10.0 + multer: 1.4.5-lts.1 + node-fetch: 3.3.2 + picocolors: 1.0.0 + source-map-support: 0.5.21 + winston: 3.13.0 + xml2js: 0.5.0 + yargs: 17.7.2 + transitivePeerDependencies: + - '@types/express' + - '@typespec/versioning' + - encoding + - supports-color dev: true - /@azure-tools/typespec-azure-core@0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0): - resolution: {integrity: sha512-bnVrLxyjhMfKv75POL3m+lWjyqpLtWYEM9t2mrhFECHfW3+gWzTKIg98oNMKLXmev/sCc9QhbkKLs72jqxNL1Q==} + /@azure-tools/typespec-autorest@0.42.0(@azure-tools/typespec-azure-core@0.42.0)(@azure-tools/typespec-client-generator-core@0.42.2)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-3cB5SiIbRDvGXpadnxwqsNhQ4A9pteGTHIpVlKpENpvzIoWU9phe+uBmGJDiQ/9CQPiLk7JncER95XYVOvn/vA==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/rest': ~0.55.0 + '@azure-tools/typespec-azure-core': ~0.42.0 + '@azure-tools/typespec-client-generator-core': ~0.42.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/openapi': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) + '@azure-tools/typespec-client-generator-core': 0.42.2(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/openapi': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) + dev: true + + /@azure-tools/typespec-azure-core@0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0): + resolution: {integrity: sha512-8C96RkgSWtgqsaHRMWCd2iDltFJZTGmFQiTZazZj/uRy0Wn1ikjSriSN8t1puL5SiUPd0BVJP/YXiwAfjfZYDA==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/rest': ~0.56.0 dependencies: - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) dev: true - /@azure-tools/typespec-azure-resource-manager@0.41.0(@azure-tools/typespec-autorest@0.41.0)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-KPeQQle+hd508bkRjWHDsUXhoLjXVJg0DQyPM9wIxf+3cE0yH0aUxWPU6aj+aTio84226ExO2Qh8IadqgoQ5qg==} + /@azure-tools/typespec-azure-resource-manager@0.42.0(@azure-tools/typespec-autorest@0.42.0)(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-RCqcrhE1yniAih5vDFOC5K4MpDr9XmG8qBB39G49/KyEKnWOQ3Nwvt/6fXaU42D9X2L6kfEAIz/AdiSJ/H5O6w==} engines: {node: '>=18.0.0'} peerDependencies: - '@azure-tools/typespec-autorest': ~0.41.0 - '@azure-tools/typespec-azure-core': ~0.41.0 - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/openapi': ~0.55.0 - '@typespec/rest': ~0.55.0 - '@typespec/versioning': ~0.55.0 - dependencies: - '@azure-tools/typespec-autorest': 0.41.0(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.8)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) - '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@azure-tools/typespec-autorest': ~0.42.0 + '@azure-tools/typespec-azure-core': ~0.42.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/openapi': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@azure-tools/typespec-autorest': 0.42.0(@azure-tools/typespec-azure-core@0.42.0)(@azure-tools/typespec-client-generator-core@0.42.2)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0) + '@azure-tools/typespec-azure-core': 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/openapi': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) + change-case: 5.4.4 + pluralize: 8.0.0 dev: true - /@azure-tools/typespec-client-generator-core@0.41.8(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-d72LPwkEio/swqyAAgcuOaw+K4ghSbZcRjpjsvddxHWHh25ZukjD2hU/BfCtidnKptgKjs79fV++w2MYE6sTyw==} + /@azure-tools/typespec-client-generator-core@0.42.2(@azure-tools/typespec-azure-core@0.42.0)(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-Hei86GqNFfKpFhivZPpKo1ktSRQMnZKjLoMwIumklmMpeo5KgyzEgRSpJEiS+zmPZELs2Fu07VgfvpW0IXurUg==} engines: {node: '>=18.0.0'} peerDependencies: - '@azure-tools/typespec-azure-core': ~0.41.0 - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/rest': ~0.55.0 - '@typespec/versioning': ~0.55.0 - dependencies: - '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@azure-tools/typespec-azure-core': ~0.42.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/rest': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.42.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/rest@0.56.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/rest': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) change-case: 5.4.4 pluralize: 8.0.0 dev: true @@ -687,16 +736,6 @@ packages: kuler: 2.0.0 dev: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.56.0): - resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - dependencies: - eslint: 8.56.0 - eslint-visitor-keys: 3.4.3 - dev: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.57.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -729,11 +768,6 @@ packages: - supports-color dev: true - /@eslint/js@8.56.0: - resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - /@eslint/js@8.57.0: resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -1323,8 +1357,8 @@ packages: resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} dev: true - /@types/json-schema@7.0.12: - resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: true /@types/json5@0.0.29: @@ -1369,8 +1403,8 @@ packages: resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} dev: true - /@types/semver@7.5.0: - resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} + /@types/semver@7.5.8: + resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} dev: true /@types/triple-beam@1.3.2: @@ -1387,8 +1421,8 @@ packages: '@types/node': 18.19.29 dev: true - /@typescript-eslint/eslint-plugin@7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4): - resolution: {integrity: sha512-HpqNTH8Du34nLxbKgVMGljZMG0rJd2O9ecvr2QLYp+7512ty1j42KnsFwspPXg1Vh8an9YImf6CokUBltisZFQ==} + /@typescript-eslint/eslint-plugin@7.8.0(@typescript-eslint/parser@7.8.0)(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-gFTT+ezJmkwutUPmB0skOj3GZJtlEGnlssems4AjkVweUPGj7jRwwqg0Hhg7++kPGJqKtTYx+R05Ftww372aIg==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: '@typescript-eslint/parser': ^7.0.0 @@ -1399,25 +1433,25 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.5.0(eslint@8.56.0)(typescript@5.1.3) - '@typescript-eslint/scope-manager': 7.5.0 - '@typescript-eslint/type-utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) - '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) - '@typescript-eslint/visitor-keys': 7.5.0 + '@typescript-eslint/parser': 7.8.0(eslint@8.57.0)(typescript@5.1.3) + '@typescript-eslint/scope-manager': 7.8.0 + '@typescript-eslint/type-utils': 7.8.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.8.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/visitor-keys': 7.8.0 debug: 4.3.4(supports-color@8.1.1) eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.1 natural-compare: 1.4.0 semver: 7.6.0 - ts-api-utils: 1.0.1(typescript@5.4.4) - typescript: 5.4.4 + ts-api-utils: 1.3.0(typescript@5.4.5) + typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@7.5.0(eslint@8.56.0)(typescript@5.1.3): - resolution: {integrity: sha512-cj+XGhNujfD2/wzR1tabNsidnYRaFfEkcULdcIyVBYcXjBvBKOes+mpMBP7hMpOyk+gBcfXsrg4NBGAStQyxjQ==} + /@typescript-eslint/parser@7.8.0(eslint@8.57.0)(typescript@5.1.3): + resolution: {integrity: sha512-KgKQly1pv0l4ltcftP59uQZCi4HUYswCLbTqVZEJu7uLX8CTLyswqMLqLN+2QFz4jCptqWVV4SB7vdxcH2+0kQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -1426,12 +1460,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 7.5.0 - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.1.3) - '@typescript-eslint/visitor-keys': 7.5.0 + '@typescript-eslint/scope-manager': 7.8.0 + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.1.3) + '@typescript-eslint/visitor-keys': 7.8.0 debug: 4.3.4(supports-color@8.1.1) - eslint: 8.56.0 + eslint: 8.57.0 typescript: 5.1.3 transitivePeerDependencies: - supports-color @@ -1445,16 +1479,16 @@ packages: '@typescript-eslint/visitor-keys': 6.21.0 dev: true - /@typescript-eslint/scope-manager@7.5.0: - resolution: {integrity: sha512-Z1r7uJY0MDeUlql9XJ6kRVgk/sP11sr3HKXn268HZyqL7i4cEfrdFuSSY/0tUqT37l5zT0tJOsuDP16kio85iA==} + /@typescript-eslint/scope-manager@7.8.0: + resolution: {integrity: sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g==} engines: {node: ^18.18.0 || >=20.0.0} dependencies: - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/visitor-keys': 7.5.0 + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/visitor-keys': 7.8.0 dev: true - /@typescript-eslint/type-utils@7.5.0(eslint@8.57.0)(typescript@5.4.4): - resolution: {integrity: sha512-A021Rj33+G8mx2Dqh0nMO9GyjjIBK3MqgVgZ2qlKf6CJy51wY/lkkFqq3TqqnH34XyAHUkq27IjlUkWlQRpLHw==} + /@typescript-eslint/type-utils@7.8.0(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -1463,12 +1497,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.4) - '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) + '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.4.5) + '@typescript-eslint/utils': 7.8.0(eslint@8.57.0)(typescript@5.4.5) debug: 4.3.4(supports-color@8.1.1) eslint: 8.57.0 - ts-api-utils: 1.0.1(typescript@5.4.4) - typescript: 5.4.4 + ts-api-utils: 1.3.0(typescript@5.4.5) + typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true @@ -1478,12 +1512,12 @@ packages: engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/types@7.5.0: - resolution: {integrity: sha512-tv5B4IHeAdhR7uS4+bf8Ov3k793VEVHd45viRRkehIUZxm0WF82VPiLgHzA/Xl4TGPg1ZD49vfxBKFPecD5/mg==} + /@typescript-eslint/types@7.8.0: + resolution: {integrity: sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw==} engines: {node: ^18.18.0 || >=20.0.0} dev: true - /@typescript-eslint/typescript-estree@6.21.0(typescript@5.4.4): + /@typescript-eslint/typescript-estree@6.21.0(typescript@5.4.5): resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1499,14 +1533,14 @@ packages: is-glob: 4.0.3 minimatch: 9.0.3 semver: 7.6.0 - ts-api-utils: 1.0.1(typescript@5.4.4) - typescript: 5.4.4 + ts-api-utils: 1.3.0(typescript@5.4.5) + typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/typescript-estree@7.5.0(typescript@5.1.3): - resolution: {integrity: sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==} + /@typescript-eslint/typescript-estree@7.8.0(typescript@5.1.3): + resolution: {integrity: sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: typescript: '*' @@ -1514,21 +1548,21 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/visitor-keys': 7.5.0 + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/visitor-keys': 7.8.0 debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 - minimatch: 9.0.3 + minimatch: 9.0.4 semver: 7.6.0 - ts-api-utils: 1.0.1(typescript@5.1.3) + ts-api-utils: 1.3.0(typescript@5.1.3) typescript: 5.1.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/typescript-estree@7.5.0(typescript@5.4.4): - resolution: {integrity: sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==} + /@typescript-eslint/typescript-estree@7.8.0(typescript@5.4.5): + resolution: {integrity: sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: typescript: '*' @@ -1536,31 +1570,31 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/visitor-keys': 7.5.0 + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/visitor-keys': 7.8.0 debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 - minimatch: 9.0.3 + minimatch: 9.0.4 semver: 7.6.0 - ts-api-utils: 1.0.1(typescript@5.4.4) - typescript: 5.4.4 + ts-api-utils: 1.3.0(typescript@5.4.5) + typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@6.21.0(eslint@8.57.0)(typescript@5.4.4): + /@typescript-eslint/utils@6.21.0(eslint@8.57.0)(typescript@5.4.5): resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@types/json-schema': 7.0.12 - '@types/semver': 7.5.0 + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 6.21.0 '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.4) + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.5) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: @@ -1568,18 +1602,18 @@ packages: - typescript dev: true - /@typescript-eslint/utils@7.5.0(eslint@8.57.0)(typescript@5.4.4): - resolution: {integrity: sha512-3vZl9u0R+/FLQcpy2EHyRGNqAS/ofJ3Ji8aebilfJe+fobK8+LbIFmrHciLVDxjDoONmufDcnVSF38KwMEOjzw==} + /@typescript-eslint/utils@7.8.0(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@types/json-schema': 7.0.12 - '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 7.5.0 - '@typescript-eslint/types': 7.5.0 - '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.4) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.8 + '@typescript-eslint/scope-manager': 7.8.0 + '@typescript-eslint/types': 7.8.0 + '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.4.5) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: @@ -1595,11 +1629,11 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@typescript-eslint/visitor-keys@7.5.0: - resolution: {integrity: sha512-mcuHM/QircmA6O7fy6nn2w/3ditQkj+SgtOc8DW3uQ10Yfj42amm2i+6F2K4YAOPNNTmE6iM1ynM6lrSwdendA==} + /@typescript-eslint/visitor-keys@7.8.0: + resolution: {integrity: sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA==} engines: {node: ^18.18.0 || >=20.0.0} dependencies: - '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/types': 7.8.0 eslint-visitor-keys: 3.4.3 dev: true @@ -1610,7 +1644,27 @@ packages: dependencies: '@babel/code-frame': 7.24.2 ajv: 8.12.0 - change-case: 5.4.3 + change-case: 5.4.4 + globby: 14.0.1 + mustache: 4.2.0 + picocolors: 1.0.0 + prettier: 3.2.5 + prompts: 2.4.2 + semver: 7.6.0 + vscode-languageserver: 9.0.1 + vscode-languageserver-textdocument: 1.0.11 + yaml: 2.4.1 + yargs: 17.7.2 + dev: true + + /@typespec/compiler@0.56.0: + resolution: {integrity: sha512-K+VhXycoeqcoSGtB0/l1XYco4V2qRsCOOwqklVM4Yew7kTcKVfz7CT7a6a2OKWDMNg5iijZtRBoM5YF50XtQug==} + engines: {node: '>=18.0.0'} + hasBin: true + dependencies: + '@babel/code-frame': 7.24.2 + ajv: 8.12.0 + change-case: 5.4.4 globby: 14.0.1 mustache: 4.2.0 picocolors: 1.0.0 @@ -1624,17 +1678,18 @@ packages: /@typespec/eslint-config-typespec@0.55.0(prettier@3.2.5): resolution: {integrity: sha512-zZI2ERGdgM9T6neL+Qdht3z89elGI38h68vSYnq5KFR3J500llSJI0Yb5NnE1G2Y7pjmBrnYWhL7UoOaGpW42A==} + deprecated: Package is deprecated as it was meant for TypeSpec internal use only dependencies: '@rushstack/eslint-patch': 1.10.1 - '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4) - '@typescript-eslint/parser': 7.5.0(eslint@8.56.0)(typescript@5.1.3) + '@typescript-eslint/eslint-plugin': 7.8.0(@typescript-eslint/parser@7.8.0)(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.8.0(eslint@8.57.0)(typescript@5.1.3) eslint: 8.57.0 eslint-config-prettier: 9.1.0(eslint@8.57.0) - eslint-plugin-deprecation: 2.0.0(eslint@8.57.0)(typescript@5.4.4) + eslint-plugin-deprecation: 2.0.0(eslint@8.57.0)(typescript@5.4.5) eslint-plugin-prettier: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5) eslint-plugin-unicorn: 51.0.1(eslint@8.57.0) - eslint-plugin-vitest: 0.4.1(@typescript-eslint/eslint-plugin@7.5.0)(eslint@8.57.0)(typescript@5.4.4) - typescript: 5.4.4 + eslint-plugin-vitest: 0.4.1(@typescript-eslint/eslint-plugin@7.8.0)(eslint@8.57.0)(typescript@5.4.5) + typescript: 5.4.5 transitivePeerDependencies: - '@types/eslint' - prettier @@ -1649,32 +1704,41 @@ packages: '@typespec/compiler': ~0.55.0 dependencies: '@typespec/compiler': 0.55.0 + dev: true - /@typespec/openapi3@0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/versioning@0.55.0): - resolution: {integrity: sha512-dfn/wrKSF4Ls1dWMpAguQggoc4HGx2tf3FN2xhBln6EtahNZNgN5sOE+XY0hGPI4MCE5QexMUlXSiXpxzlNA/A==} + /@typespec/http@0.56.0(@typespec/compiler@0.56.0): + resolution: {integrity: sha512-f/tpHRWev9bnAtNPFkfCU/5SFou9glA/rPDY0m2W5bK6EG1/6/TKKKz5FoKPA4xvc2dQ5vu/ouGLb4i5UzXvWQ==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 - '@typespec/openapi': ~0.55.0 - '@typespec/versioning': ~0.55.0 + '@typespec/compiler': ~0.56.0 dependencies: - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) - '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) - '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/compiler': 0.56.0 + + /@typespec/openapi3@0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0)(@typespec/openapi@0.56.0)(@typespec/versioning@0.56.0): + resolution: {integrity: sha512-55JPUP7dFk4iXn4fNKZEs76j7hAdlWfoMWNPsQPRJCP//KWCtNXfTP+/TTVPVv1L/6HztbXyPV0agKZwyS7gDw==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + '@typespec/openapi': ~0.56.0 + '@typespec/versioning': ~0.56.0 + dependencies: + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + '@typespec/openapi': 0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0) + '@typespec/versioning': 0.56.0(@typespec/compiler@0.56.0) yaml: 2.4.1 dev: false - /@typespec/openapi@0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0): - resolution: {integrity: sha512-5T4VuJSOGfMFSs+1dOl3U3BC6VhKAxSTBrwcQDIEEygnqCSbj/tMFDhNfzKYKARRDotgM8ESOrZU6XH5srVR7A==} + /@typespec/openapi@0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0): + resolution: {integrity: sha512-q8+IHRglXBm3slvonRLSNYN2fX7plbWA+ugIiMJZTeyc3enqfxPqMGA8BCiAFV3kwP0uPPpIXbCSIVhHgkONbA==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.55.0 - '@typespec/http': ~0.55.0 + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 dependencies: - '@typespec/compiler': 0.55.0 - '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) /@typespec/prettier-plugin-typespec@0.55.0: resolution: {integrity: sha512-CrrZbN3EmT4rMckthSYZ2VeIET1pi2IAM/W9jN8pPfyqvidDhc/uCEy3gfbc9wvFKejC5Ykc/qE5MO79xvgH4Q==} @@ -1693,6 +1757,17 @@ packages: '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) dev: true + /@typespec/rest@0.56.0(@typespec/compiler@0.56.0)(@typespec/http@0.56.0): + resolution: {integrity: sha512-8w4WhWDcpEQNW8bB1BHhiBxIQUChDJtyq/n9p2OI/Bm1wncd61y/ZNOtcxmlKq8uB9d+dzHiZdEfqFCR8HF8/Q==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 + '@typespec/http': ~0.56.0 + dependencies: + '@typespec/compiler': 0.56.0 + '@typespec/http': 0.56.0(@typespec/compiler@0.56.0) + dev: true + /@typespec/versioning@0.55.0(@typespec/compiler@0.55.0): resolution: {integrity: sha512-89LTgkA3IBLnaaM4D4qfsrcEU0g3gasE1MmkrQ2HG21fYX88zKbmR1cKWeUxQx9MIXFOH4cPC9KhA/uLknRVMQ==} engines: {node: '>=18.0.0'} @@ -1700,6 +1775,15 @@ packages: '@typespec/compiler': ~0.55.0 dependencies: '@typespec/compiler': 0.55.0 + dev: true + + /@typespec/versioning@0.56.0(@typespec/compiler@0.56.0): + resolution: {integrity: sha512-j7IN9XFyGn3LH6IOJkinEvk9sDncsxiWPULOAe0VQ+D/dtCfLawDMUALnvklMDRKeD1OOUPSCjjUAp9OB0f7YA==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.56.0 + dependencies: + '@typespec/compiler': 0.56.0 /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -2050,10 +2134,10 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001594 - electron-to-chromium: 1.4.693 + caniuse-lite: 1.0.30001617 + electron-to-chromium: 1.4.762 node-releases: 2.0.14 - update-browserslist-db: 1.0.13(browserslist@4.23.0) + update-browserslist-db: 1.0.15(browserslist@4.23.0) dev: true /btoa-lite@1.0.0: @@ -2156,8 +2240,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite@1.0.30001594: - resolution: {integrity: sha512-VblSX6nYqyJVs8DKFMldE2IVCJjZ225LW00ydtUWwh5hk9IfkTOffO6r8gJNsH0qqqeAF8KrbMYA2VEwTlGW5g==} + /caniuse-lite@1.0.30001617: + resolution: {integrity: sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA==} dev: true /caseless@0.12.0: @@ -2180,12 +2264,8 @@ packages: supports-color: 7.2.0 dev: true - /change-case@5.4.3: - resolution: {integrity: sha512-4cdyvorTy/lViZlVzw2O8/hHCLUuHqp4KpSSP3DlauhFCf3LdnfF+p5s0EAhjKsU7bqrMzu7iQArYfoPiHO2nw==} - /change-case@5.4.4: resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==} - dev: true /chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} @@ -2310,7 +2390,7 @@ packages: dev: true /concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} dev: true /concat-stream@1.6.2: @@ -2353,8 +2433,8 @@ packages: engines: {node: '>= 0.6'} dev: true - /core-js-compat@3.36.0: - resolution: {integrity: sha512-iV9Pd/PsgjNWBXeq8XRtWVSgz2tKAfhfvBs7qxYty+RlRd+OCksaWmOnc4JKrTc1cToXL1N0s3l/vwlxPtdElw==} + /core-js-compat@3.37.0: + resolution: {integrity: sha512-vYq4L+T8aS5UuFg4UwDhc7YNRWVeVZwltad9C/jV3R2LgVOpS9BDr7l/WL6BN0dbV3k1XejPTHqqEzJgsa0frA==} dependencies: browserslist: 4.23.0 dev: true @@ -2609,8 +2689,8 @@ packages: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} dev: true - /electron-to-chromium@1.4.693: - resolution: {integrity: sha512-/if4Ueg0GUQlhCrW2ZlXwDAm40ipuKo+OgeHInlL8sbjt+hzISxZK949fZeJaVsheamrzANXvw1zQTvbxTvSHw==} + /electron-to-chromium@1.4.762: + resolution: {integrity: sha512-rrFvGweLxPwwSwJOjIopy3Vr+J3cIPtZzuc74bmlvmBIgQO3VYJDvVrlj94iKZ3ukXUH64Ex31hSfRTLqvjYJQ==} dev: true /emoji-regex@8.0.0: @@ -2765,8 +2845,8 @@ packages: is-symbol: 1.0.4 dev: true - /escalade@3.1.1: - resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} + /escalade@3.1.2: + resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} engines: {node: '>=6'} /escape-html@1.0.3: @@ -2829,17 +2909,17 @@ packages: - supports-color dev: true - /eslint-plugin-deprecation@2.0.0(eslint@8.57.0)(typescript@5.4.4): + /eslint-plugin-deprecation@2.0.0(eslint@8.57.0)(typescript@5.4.5): resolution: {integrity: sha512-OAm9Ohzbj11/ZFyICyR5N6LbOIvQMp7ZU2zI7Ej0jIc8kiGUERXPNMfw2QqqHD1ZHtjMub3yPZILovYEYucgoQ==} peerDependencies: eslint: ^7.0.0 || ^8.0.0 typescript: ^4.2.4 || ^5.0.0 dependencies: - '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.4.4) + '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.4.5) eslint: 8.57.0 tslib: 2.6.2 - tsutils: 3.21.0(typescript@5.4.4) - typescript: 5.4.4 + tsutils: 3.21.0(typescript@5.4.5) + typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true @@ -2935,7 +3015,7 @@ packages: '@eslint/eslintrc': 2.1.4 ci-info: 4.0.0 clean-regexp: 1.0.0 - core-js-compat: 3.36.0 + core-js-compat: 3.37.0 eslint: 8.57.0 esquery: 1.5.0 indent-string: 4.0.0 @@ -2951,7 +3031,7 @@ packages: - supports-color dev: true - /eslint-plugin-vitest@0.4.1(@typescript-eslint/eslint-plugin@7.5.0)(eslint@8.57.0)(typescript@5.4.4): + /eslint-plugin-vitest@0.4.1(@typescript-eslint/eslint-plugin@7.8.0)(eslint@8.57.0)(typescript@5.4.5): resolution: {integrity: sha512-+PnZ2u/BS+f5FiuHXz4zKsHPcMKHie+K+1Uvu/x91ovkCMEOJqEI8E9Tw1Wzx2QRz4MHOBHYf1ypO8N1K0aNAA==} engines: {node: ^18.0.0 || >= 20.0.0} peerDependencies: @@ -2964,8 +3044,8 @@ packages: vitest: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4) - '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) + '@typescript-eslint/eslint-plugin': 7.8.0(@typescript-eslint/parser@7.8.0)(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.8.0(eslint@8.57.0)(typescript@5.4.5) eslint: 8.57.0 transitivePeerDependencies: - supports-color @@ -2985,53 +3065,6 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.56.0: - resolution: {integrity: sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - hasBin: true - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) - '@eslint-community/regexpp': 4.10.0 - '@eslint/eslintrc': 2.1.4 - '@eslint/js': 8.56.0 - '@humanwhocodes/config-array': 0.11.14 - '@humanwhocodes/module-importer': 1.0.1 - '@nodelib/fs.walk': 1.2.8 - '@ungap/structured-clone': 1.2.0 - ajv: 6.12.6 - chalk: 4.1.2 - cross-spawn: 7.0.3 - debug: 4.3.4(supports-color@8.1.1) - doctrine: 3.0.0 - escape-string-regexp: 4.0.0 - eslint-scope: 7.2.2 - eslint-visitor-keys: 3.4.3 - espree: 9.6.1 - esquery: 1.5.0 - esutils: 2.0.3 - fast-deep-equal: 3.1.3 - file-entry-cache: 6.0.1 - find-up: 5.0.0 - glob-parent: 6.0.2 - globals: 13.24.0 - graphemer: 1.4.0 - ignore: 5.3.1 - imurmurhash: 0.1.4 - is-glob: 4.0.3 - is-path-inside: 3.0.3 - js-yaml: 4.1.0 - json-stable-stringify-without-jsonify: 1.0.1 - levn: 0.4.1 - lodash.merge: 4.6.2 - minimatch: 3.1.2 - natural-compare: 1.4.0 - optionator: 0.9.3 - strip-ansi: 6.0.1 - text-table: 0.2.0 - transitivePeerDependencies: - - supports-color - dev: true - /eslint@8.57.0: resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3679,7 +3712,7 @@ packages: /has-property-descriptors@1.0.0: resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==} dependencies: - get-intrinsic: 1.2.1 + get-intrinsic: 1.2.4 dev: true /has-property-descriptors@1.0.2: @@ -6113,22 +6146,22 @@ packages: engines: {node: '>= 14.0.0'} dev: true - /ts-api-utils@1.0.1(typescript@5.1.3): - resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} - engines: {node: '>=16.13.0'} + /ts-api-utils@1.3.0(typescript@5.1.3): + resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + engines: {node: '>=16'} peerDependencies: typescript: '>=4.2.0' dependencies: typescript: 5.1.3 dev: true - /ts-api-utils@1.0.1(typescript@5.4.4): - resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} - engines: {node: '>=16.13.0'} + /ts-api-utils@1.3.0(typescript@5.4.5): + resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + engines: {node: '>=16'} peerDependencies: typescript: '>=4.2.0' dependencies: - typescript: 5.4.4 + typescript: 5.4.5 dev: true /tsconfig-paths@3.15.0: @@ -6147,14 +6180,14 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - /tsutils@3.21.0(typescript@5.4.4): + /tsutils@3.21.0(typescript@5.4.5): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 5.4.4 + typescript: 5.4.5 dev: true /tuf-js@2.2.0: @@ -6273,8 +6306,8 @@ packages: hasBin: true dev: true - /typescript@5.4.4: - resolution: {integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==} + /typescript@5.4.5: + resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} engines: {node: '>=14.17'} hasBin: true dev: true @@ -6346,14 +6379,14 @@ packages: engines: {node: '>= 0.8'} dev: true - /update-browserslist-db@1.0.13(browserslist@4.23.0): - resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} + /update-browserslist-db@1.0.15(browserslist@4.23.0): + resolution: {integrity: sha512-K9HWH62x3/EalU1U6sjSZiylm9C8tgq2mSvshZpqc7QE69RaA2qjhkW2HlNA0tFpEbtyFz7HTqbSdN4MSwUodA==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' dependencies: browserslist: 4.23.0 - escalade: 3.1.1 + escalade: 3.1.2 picocolors: 1.0.0 dev: true @@ -6668,7 +6701,7 @@ packages: engines: {node: '>=10'} dependencies: cliui: 7.0.4 - escalade: 3.1.1 + escalade: 3.1.2 get-caller-file: 2.0.5 require-directory: 2.1.1 string-width: 4.2.3 @@ -6681,7 +6714,7 @@ packages: engines: {node: '>=12'} dependencies: cliui: 8.0.1 - escalade: 3.1.1 + escalade: 3.1.2 get-caller-file: 2.0.5 require-directory: 2.1.1 string-width: 4.2.3 @@ -6700,3 +6733,7 @@ packages: /zod@3.22.4: resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} dev: true + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false